GHSA-JRF2-H5J6-3RRQ

Vulnerability from github – Published: 2023-10-19 16:11 – Updated: 2023-10-19 16:11
VLAI
Summary
Bunkum tokens cached in the AuthenticationService are susceptible to a use-after-free
Details

Impact

First, a little bit of background. So, in the beginning, Bunkum's AuthenticationService only supported injecting IUsers. However, as Refresh and SoundShapesServer implemented permissions systems support for injecting ITokens into endpoints was added. All was well until 4.0.

Bunkum 4.0 then changed to enforce relations between ITokens and IUsers. This wasn't implemented in a very good way in the AuthenticationService, and ended up breaking caching in such a way that cached tokens would persist after the lifetime of the request - since we tried to cache both tokens and users. From that point until now, from what I understand, Bunkum was attempting to use that cached token at the start of the next request once cached.

Naturally, when that token expired, downstream projects like Refresh would remove the object from Realm - and cause the object in the cache to be in a detached state, causing an exception from invalid use of IToken.User. So in other words, a use-after-free since Realm can't manage the lifetime of the cached token.

Security-wise, the scope is fairly limited, can only be pulled off on a couple endpoints given a few conditions, and you can't guarantee which token you're going to get. Also, the token would get invalidated properly if the endpoint had either a IToken usage or a IUser usage. User interaction is required as authenticated requests must be performed.

Patches

The fix is to just wipe the token cache after the request was handled, which is now in 4.2.1. I'd recommend that you update. Unfortunately, there are no real workarounds for other versions in the 4.X.X range.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "NuGet",
        "name": "Bunkum"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "4.0.0"
            },
            {
              "fixed": "4.2.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2023-45814"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-772"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2023-10-19T16:11:59Z",
    "nvd_published_at": "2023-10-18T22:15:09Z",
    "severity": "MODERATE"
  },
  "details": "### Impact\nFirst, a little bit of background. So, in the beginning, Bunkum\u0027s `AuthenticationService` only supported injecting `IUser`s. However, as Refresh and SoundShapesServer implemented permissions systems support for injecting `IToken`s into endpoints was added. All was well until 4.0.\n\nBunkum 4.0 then changed to enforce relations between `IToken`s and `IUser`s. This wasn\u0027t implemented in a very good way in the `AuthenticationService`, and ended up breaking caching in such a way that cached tokens would persist after the lifetime of the request - since we tried to cache both tokens and users. From that point until now, from what I understand, Bunkum was attempting to use that cached token at the start of the next request once cached.\n\nNaturally, when that token expired, downstream projects like Refresh would remove the object from Realm - and cause the object in the cache to be in a detached state, causing an exception from invalid use of `IToken.User`. So in other words, a use-after-free since Realm can\u0027t manage the lifetime of the cached token.\n\nSecurity-wise, the scope is fairly limited, can only be pulled off on a couple endpoints given a few conditions, and you can\u0027t guarantee which token you\u0027re going to get. Also, the token *would* get invalidated properly if the endpoint had either a `IToken` usage or a `IUser` usage. User interaction is required as authenticated requests must be performed.\n\n### Patches\nThe fix is to just wipe the token cache after the request was handled, which is now in `4.2.1`. I\u0027d recommend that you update. Unfortunately, there are no real workarounds for other versions in the 4.X.X range.",
  "id": "GHSA-jrf2-h5j6-3rrq",
  "modified": "2023-10-19T16:11:59Z",
  "published": "2023-10-19T16:11:59Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/LittleBigRefresh/Bunkum/security/advisories/GHSA-jrf2-h5j6-3rrq"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-45814"
    },
    {
      "type": "WEB",
      "url": "https://github.com/LittleBigRefresh/Bunkum/commit/6e109464ed9255f558182f001f475a378405ff76"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/LittleBigRefresh/Bunkum"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Bunkum tokens cached in the AuthenticationService are susceptible to a use-after-free"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…