Skip to content
Heist/ feed
Back to feed
Medium

Tokens cached in the AuthenticationService are susceptible to reuse in Bunkum

Type: advisorySources: OSV

Bunkum is an open-source protocol-agnostic request server for custom game servers. First, a little bit of background. So, in the beginning, Bunkum's `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. Bunkum 4.0 then changed to enforce relations between `IToken`s and `IUser`s. 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. The fix is to just wipe the token cache after the request was handled, which is

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2023-45814
Confirmed fixed CVEs
Not specified
Updated in this feed
5 Nov 2026, 03:35 UTC · Revision 1

Source evidence

Tokens cached in the AuthenticationService are susceptible to reuse in Bunkum

core-osv · Original source

Published 18 Oct 2023, 21:22 UTC

Bunkum is an open-source protocol-agnostic request server for custom game servers. First, a little bit of background. So, in the beginning, Bunkum's `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. Bunkum 4.0 then changed to enforce relations between `IToken`s and `IUser`s. 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. The fix is to just wipe the token cache after the request was handled, which is

osv:CVE-2023-45814
Complete source record
{
  "id": "a75cead508ec54ede345e1f22b31cd48611e4e64c764ec52caab990bc6afc722",
  "url": "https://osv.dev/vulnerability/CVE-2023-45814",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Tokens cached in the AuthenticationService are susceptible to reuse in Bunkum",
    "summary": "Bunkum is an open-source protocol-agnostic request server for custom game servers. First, a little bit of background. So, in the beginning, Bunkum's `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. Bunkum 4.0 then changed to enforce relations between `IToken`s and `IUser`s. 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. The fix is to just wipe the token cache after the request was handled, which is",
    "evidence": "osv:CVE-2023-45814",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2023-45814",
      "aliases": [
        "CVE-2023-45814",
        "GHSA-jrf2-h5j6-3rrq"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/littlebigrefresh/bunkum",
              "type": "GIT",
              "events": [
                {
                  "introduced": "2ad320dd2118cf461b747755f505d1a2fc209b1d"
                },
                {
                  "fixed": "6e109464ed9255f558182f001f475a378405ff76"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "4.0.0"
                      },
                      {
                        "fixed": "4.2.1"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "range": [
                      {
                        "fixed": "6e109464ed9255f558182f001f475a378405ff76"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "cpe": "cpe:2.3:a:littlebigfresh:bunkum:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "4.0"
                      },
                      {
                        "fixed": "4.2.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v4.2.0",
            "v4.1.0",
            "v4.0.1",
            "v4.0.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-45814.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:42.233904606Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/45xxx/CVE-2023-45814.json",
        "https://github.com/LittleBigRefresh/Bunkum/security/advisories/GHSA-jrf2-h5j6-3rrq",
        "https://nvd.nist.gov/vuln/detail/CVE-2023-45814",
        "https://github.com/LittleBigRefresh/Bunkum/commit/6e109464ed9255f558182f001f475a378405ff76"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-772"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/45xxx/CVE-2023-45814.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2023-45814",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 509886,
  "published_at": "2023-10-18T21:22:03.066+00:00"
}