ghsa-29pr-6jr8-q5jm
Vulnerability from github
Published
2023-03-21 22:31
Modified
2023-03-22 21:49
Summary
Sentry SDK leaks sensitive session information when `sendDefaultPII` is set to `True`
Details

Impact

When using the Django integration of the Sentry SDK in a specific configuration it is possible to leak sensitive cookies values, including the session cookie to Sentry. These sensitive cookies could then be used by someone with access to your Sentry issues to impersonate or escalate their privileges within your application.

The below must be true in order for these sensitive values to be leaked: 1. Your Sentry SDK configuration has sendDefaultPII set to True 2. You are using a custom name for either of the cookies below in your Django settings. - SESSION_COOKIE_NAME or - CSRF_COOKIE_NAME Django settings 3. You are not configured in your organization or project settings to use our data scrubbing features to account for the custom cookie names

Patches

As of version 1.14.0, the Django integration of the sentry-sdk will detect the custom cookie names based on your Django settings and will remove the values from the payload before sending the data to Sentry.

Workarounds

If you can not update your sentry-sdk to a patched version than you can use the SDKs filtering mechanism to remove the cookies from the payload that is sent to Sentry. For error events this can be done with the before_send callback method and for performance related events (transactions) you can use the before_send_transaction callback method.

If you'd like to handle filtering of these values on the server-side, you can also use our advanced data scrubbing feature to account for the custom cookie names. Look for the $http.cookies, $http.headers, $request.cookies, or $request.headers fields to target with your scrubbing rule.

References

Credits

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "sentry-sdk"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.14.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2023-28117"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-201",
      "CWE-209"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2023-03-21T22:31:19Z",
    "nvd_published_at": "2023-03-22T20:15:00Z",
    "severity": "HIGH"
  },
  "details": "### Impact\n\nWhen using the [Django integration](https://docs.sentry.io/platforms/python/guides/django/) of the Sentry SDK in a specific configuration it is possible to leak sensitive cookies values, including the session cookie to Sentry. These sensitive cookies could then be used by someone with access to your Sentry issues to impersonate or escalate their privileges within your application.\n\nThe below must be true in order for these sensitive values to be leaked:\n1. Your Sentry SDK configuration has `sendDefaultPII` set to `True`\n2. You are using a custom name for either of the cookies below in your Django settings.\n  - [`SESSION_COOKIE_NAME`](https://docs.djangoproject.com/en/4.1/ref/settings/#std-setting-SESSION_COOKIE_NAME) or \n  - [`CSRF_COOKIE_NAME`](https://docs.djangoproject.com/en/4.1/ref/settings/#std-setting-CSRF_COOKIE_NAME) Django settings\n3. You are not configured in your organization or project settings to use [our data scrubbing features](https://docs.sentry.io/product/data-management-settings/scrubbing/) to account for the custom cookie names\n\n### Patches\nAs of version `1.14.0`, the Django integration of the `sentry-sdk` will detect the custom cookie names based on your Django settings and will remove the values from the payload _before_ sending the data to Sentry.\n\n### Workarounds\n\nIf you can not update your `sentry-sdk` to a patched version than you can use the SDKs filtering mechanism to remove the cookies from the payload that is sent to Sentry. For error events this can be done with the [before_send](https://docs.sentry.io/platforms/python/configuration/filtering/#using-platformidentifier-namebefore-send-) callback method and for performance related events (transactions) you can use the [before_send_transaction](https://docs.sentry.io/platforms/python/configuration/filtering/#using-platformidentifier-namebefore-send-transaction-) callback method.\n\nIf you\u0027d like to handle filtering of these values on the server-side, you can also use our [advanced data scrubbing feature](https://docs.sentry.io/product/data-management-settings/scrubbing/advanced-datascrubbing/) to account for the custom cookie names. Look for the `$http.cookies`, `$http.headers`, `$request.cookies`, or `$request.headers` fields to target with your scrubbing rule.\n\n### References\n- [Using Your Tools Against You (Chapter8 Blog Post)](https://medium.com/@tomwolters/using-your-tools-against-you-cea4d2482ebb)\n- [Sentry Python SDK Filtering](https://docs.sentry.io/platforms/python/configuration/filtering/)\n- [Sentry Data Scrubbing](https://docs.sentry.io/product/data-management-settings/scrubbing/advanced-datascrubbing/)\n\n### Credits\n- [Tom Wolters (Chapter8)](https://chapter8.com)\n",
  "id": "GHSA-29pr-6jr8-q5jm",
  "modified": "2023-03-22T21:49:38Z",
  "published": "2023-03-21T22:31:19Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/getsentry/sentry-python/security/advisories/GHSA-29pr-6jr8-q5jm"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-28117"
    },
    {
      "type": "WEB",
      "url": "https://github.com/getsentry/sentry-python/pull/1842"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/getsentry/sentry-python"
    },
    {
      "type": "WEB",
      "url": "https://github.com/getsentry/sentry-python/releases/tag/1.14.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Sentry SDK leaks sensitive session information when `sendDefaultPII` is set to `True`"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading...

Loading...

Loading...
  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.