Vulnerabilities in pkg:pypi/emailproxy

PACKAGE
Advisory Summary

GHSA-9wgg-m99q-hhfc is a HIGH (CVSS 8.1) expired tokens can be renewed vulnerability (CWE-620: Unverified Password Change) affecting Emailproxy libraries in the PyPI ecosystem. The issue involves expired tokens can be renewed without validating the account password. Remediation is available by upgrading affected packages to version 2023.12.19.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/emailproxy

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/emailproxy. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-9wgg-m99q-hhfc - HIGH Expired tokens can be renewed without validating the account password

GHSA-9wgg-m99q-hhfc at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-9wgg-m99q-hhfc
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-620: Unverified Password Change
Affected Product Emailproxy
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-9wgg-m99q-hhfc

To remediate this vulnerability, upgrade all affected Emailproxy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

emailproxy fixed: 2023.12.19
pip install emailproxy>=2023.12.19
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show emailproxy

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-9wgg-m99q-hhfc, inspect your installed packages using pip:

pip show emailproxy

Analyze the terminal output to locate any version of Emailproxy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2023.12.19), your application is affected.

Note: The pip show emailproxy command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-620: Unverified Password Change, where when setting a new password for a user, the product does not require knowledge of the original password, or using another form of authentication. In Emailproxy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact In versions of the proxy from `2022-09-05` onwards (since 8c874c2ff3d503ac20c7d32f46e08547fcb9e23f), expired OAuth 2.0 client credentials grant (CCG) flow authorisation tokens could be renewed automatically without checking their validity against the original account configuration (i.e., the password that was set up when first creating an account in the proxy). An attacker with knowledge of valid account addresses and careful timing (specifically, attempting to log in during a period from 10 minutes prior to the token expiry time, but before a genuine login request is received) could use this issue to gain access to an account. This issue is only a security concern if you use the proxy with the CCG flow and no additional account secret encryption (see below). If this is the case, it is particularly important to update if you use the proxy in a publicly-accessible setting (i.e., it is available from the internet or across a network). To fix the issue you should switch to version [`2023-12-19`](https://github.com/simonrob/email-oauth2-proxy/releases/tag/2023-12-19) or later of the proxy immediately. If you use this flow, but have also set `encrypt_client_secret_on_first_use = True` *and* removed the original `client_secret` value from the proxy's configuration file then this issue is not a concern. For all other use-cases (e.g., a normal interactive account authentication, or the ROPCG flow), this issue is also not a concern. However, it is always recommended as best practice to keep the proxy up-to-date. ### Patches [Email OAuth 2.0 Proxy version `2023-12-19`](https://github.com/simonrob/email-oauth2-proxy/releases/tag/2023-12-19) (commit eaaa1a2e7a132bf0958dd2f99a749ad98e3212aa) fixes this issue. ### Issue details Because it was originally designed for use as an interactive, local-only service on a single device, the proxy automatically resets account access tokens if incorrect IMAP/POP/SMTP login details are provided. For public-facing deployments, the `delete_account_token_on_password_error` option is provided, and can be set to `False` to disable this behaviour, which would normally be only a nuisance, rather than a security risk. Regardless of this option's value, the proxy encrypts locally-stored tokens, and requires interactive re-authentication (or, with the resource owner password credentials grant (ROPCG) flow, the correct remote account password) to renew tokens if they expire or are reset. The proxy's token retrieval implementation was created with this interactive process in mind. The CCG flow is an administrator-level method that grants broad access without user knowledge or consent – no user interaction (or remote account password) is ever required. From 8c874c2ff3d503ac20c7d32f46e08547fcb9e23f until the fix in eaaa1a2e7a132bf0958dd2f99a749ad98e3212aa, when CCG tokens neared their expiry date (or had already expired), and the original unencrypted `client_secret` value was available they were automatically reset, renewed and encrypted with the given login password, but without checking whether that password was actually able to decrypt the _existing_ token. ### Detecting unauthorised access If you do not use the OAuth 2.0 CCG flow (which is currently only known to be supported by O365), unauthorised account access was not possible.[^1] Attempts to exploit this flaw will be revealed in the same way as any other malicious access: an unexpected reauthorisation prompt from the proxy when trying to log in with the legitimate account details. When using the CCG flow, if you have set `delete_account_token_on_password_error = False`, unauthorised access will be revealed by the presence of an unexpected login failure from the proxy when attempting to log in with the correct password. It you have not set this value, it is not possible to detect unauthorised access in O365 CCG mode except via AAD/Entra or other external logs. However, it is also worth reiterating that the CCG flow should never be used in a publicly-accessible context due to the significant and potentially dangerous account control it provides. [^1]: If you are using a provider that does not provide an OAuth 2.0 refresh token (or have configured your account's scope so that this is not present), it is possible to trigger the line of code that caused this issue, but there is no way to use it for account access because interactive authentication is still required.

GHSA-9wgg-m99q-hhfc Affected Emailproxy Versions

1 component(s)
Fixed Versions:
2023.12.19
Product / Package Ecosystem Affected Versions Fixed Version
emailproxy
PyPI
< 2023.12.19
2023.12.19

References

Frequently Asked Questions

What is GHSA-9wgg-m99q-hhfc?
GHSA-9wgg-m99q-hhfc is a security vulnerability in Emailproxy involving Expired tokens can be renewed without validating the account password under CWE-620: Unverified Password Change.
Which Emailproxy versions are affected?
Affected versions include releases prior to 2023.12.19 across affected packages: emailproxy.
What version fixes GHSA-9wgg-m99q-hhfc?
Upgrading to 2023.12.19 (or the latest patched release for your respective branch) resolves the vulnerability.
Is emailproxy affected?
Yes, emailproxy is affected in releases prior to 2023.12.19. Upgrade your dependency to 2023.12.19 or later.
What is the CVSS score of GHSA-9wgg-m99q-hhfc?
GHSA-9wgg-m99q-hhfc has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with GHSA-9wgg-m99q-hhfc?
GHSA-9wgg-m99q-hhfc is classified under CWE-620: Unverified Password Change (When setting a new password for a user, the product does not require knowledge of the original password, or using another form of authentication.).
How can I check PyPI dependencies for GHSA-9wgg-m99q-hhfc?
Run the dependency tree command: 'pip show emailproxy'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9wgg-m99q-hhfc",
  "modified" : "2023-12-20T17:54:54Z",
  "published" : "2023-12-19T23:12:03Z",
  "aliases" : [ ],
  "summary" : "Expired tokens can be renewed without validating the account password",
  "details" : "### Impact\nIn versions of the proxy from `2022-09-05` onwards (since 8c874c2ff3d503ac20c7d32f46e08547fcb9e23f), expired OAuth 2.0 client credentials grant (CCG) flow authorisation tokens could be renewed automatically without checking their validity against the original account configuration (i.e., the password that was set up when first creating an account in the proxy).\n\nAn attacker with knowledge of valid account addresses and careful timing (specifically, attempting to log in during a period from 10 minutes prior to the token expiry time, but before a genuine login request is received) could use this issue to gain access to an account.\n\nThis issue is only a security concern if you use the proxy with the CCG flow and no additional account secret encryption (see below). If this is the case, it is particularly important to update if you use the proxy in a publicly-accessible setting (i.e., it is available from the internet or across a network). To fix the issue you should switch to version [`2023-12-19`](https://github.com/simonrob/email-oauth2-proxy/releases/tag/2023-12-19) or later of the proxy immediately.\n\nIf you use this flow, but have also set `encrypt_client_secret_on_first_use = True` *and* removed the original `client_secret` value from the proxy's configuration file then this issue is not a concern.\n\nFor all other use-cases (e.g., a normal interactive account authentication, or the ROPCG flow), this issue is also not a concern. However, it is always recommended as best practice to keep the proxy up-to-date.\n\n\n### Patches\n[Email OAuth 2.0 Proxy version `2023-12-19`](https://github.com/simonrob/email-oauth2-proxy/releases/tag/2023-12-19) (commit eaaa1a2e7a132bf0958dd2f99a749ad98e3212aa) fixes this issue.\n\n\n### Issue details\nBecause it was originally designed for use as an interactive, local-only service on a single device, the proxy automatically resets account access tokens if incorrect IMAP/POP/SMTP login details are provided. For public-facing deployments, the `delete_account_token_on_password_error` option is provided, and can be set to `False` to disable this behaviour, which would normally be only a nuisance, rather than a security risk.\n\nRegardless of this option's value, the proxy encrypts locally-stored tokens, and requires interactive re-authentication (or, with the resource owner password credentials grant (ROPCG) flow, the correct remote account password) to renew tokens if they expire or are reset. The proxy's token retrieval implementation was created with this interactive process in mind.\n\nThe CCG flow is an administrator-level method that grants broad access without user knowledge or consent – no user interaction (or remote account password) is ever required. From 8c874c2ff3d503ac20c7d32f46e08547fcb9e23f until the fix in eaaa1a2e7a132bf0958dd2f99a749ad98e3212aa, when CCG tokens neared their expiry date (or had already expired), and the original unencrypted `client_secret` value was available they were automatically reset, renewed and encrypted with the given login password, but without checking whether that password was actually able to decrypt the _existing_ token.\n\n\n### Detecting unauthorised access\nIf you do not use the OAuth 2.0 CCG flow (which is currently only known to be supported by O365), unauthorised account access was not possible.[^1] Attempts to exploit this flaw will be revealed in the same way as any other malicious access: an unexpected reauthorisation prompt from the proxy when trying to log in with the legitimate account details.\n\nWhen using the CCG flow, if you have set `delete_account_token_on_password_error = False`, unauthorised access will be revealed by the presence of an unexpected login failure from the proxy when attempting to log in with the correct password.\n\nIt you have not set this value, it is not possible to detect unauthorised access in O365 CCG mode except via AAD/Entra or other external logs. However, it is also worth reiterating that the CCG flow should never be used in a publicly-accessible context due to the significant and potentially dangerous account control it provides.\n\n[^1]: If you are using a provider that does not provide an OAuth 2.0 refresh token (or have configured your account's scope so that this is not present), it is possible to trigger the line of code that caused this issue, but there is no way to use it for account access because interactive authentication is still required.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "emailproxy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2023.12.19"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2023.11.18"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/simonrob/email-oauth2-proxy/security/advisories/GHSA-9wgg-m99q-hhfc"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simonrob/email-oauth2-proxy/commit/8c874c2ff3d503ac20c7d32f46e08547fcb9e23f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simonrob/email-oauth2-proxy/commit/eaaa1a2e7a132bf0958dd2f99a749ad98e3212aa"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/simonrob/email-oauth2-proxy"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simonrob/email-oauth2-proxy/releases/tag/2023-12-19"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-620" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-12-19T23:12:03Z",
    "nvd_published_at" : null
  }
}