Description
go-base is a Go RESTful API Boilerplate template with JWT Authentication, backed by PostgreSQL. In versions prior to 2026-05-18, the JWT signing secret is hardcoded to the known string "random", letting any attacker who reads the public repository forge tokens for arbitrary users, including admin roles, and completely bypass authentication on all protected endpoints. This value is set in two places: the dev.env template (line 10) and a programmatic fallback in cmd/serve.go (line 35), so the application uses it even when no .env file is present. The original mitigation in auth/jwt/tokenauth.go (lines 22 to 25) only caught the exact string "random", letting other weak secrets through, and replaced it with an in-memory key that was not persisted, invalidating all tokens on every restart and effectively causing a denial-of-service. This issue has been fixed in version 2026-05-18.
Published: 2026-08-03
Score: 9.1 Critical
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

A hardcoded JWT signing secret of "random" was embedded in the binary and the configuration template, enabling any user who could read the public repository to craft valid authentication tokens for any user, including administrators. This direct misuse of a weak secret satisfies CWE-798, allowing attackers to forge tokens and bypass all protected endpoints without needing legitimate credentials.

Affected Systems

The vulnerability resides in the dhax:go-base Go REST API Boilerplate template. Versions released prior to 2026‑05‑18 are impacted because the secret appears in dev.env line 10 and a programmatic fallback in cmd/serve.go line 35. The fix was introduced in commit included in the 2026‑05‑18 release.

Risk and Exploitability

With a CVSS score of 9.1 the vulnerability is critically high. The EPSS score is not available, and it is not listed in CISA KEV, but the presence of a hardcoded, publicly known secret means exploitation is straightforward once the source code is accessed. An attacker merely needs to clone the repository or have visibility into the default configuration; they can impersonate any user by generating new JWTs signed with the known secret. The attack can be carried out remotely against the running service if it is configured to use the default secret, enabling full authentication bypass, privilege escalation, and potential data compromise.

Generated by OpenCVE AI on August 4, 2026 at 20:56 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the go‑base boilerplate to version 2026‑05‑18 or later so that the hardcoded secret is removed and a new random secret is generated or required.
  • Configure a strong, unique JWT secret in an environment variable or secure configuration file (e.g., set JWT_SECRET) before starting the service. This overrides any default secret and ensures the fallback to a weak string is not used.
  • Implement runtime validation that rejects secrets shorter than a secure minimum length (e.g., 32 characters) and enforce that secrets are not hardcoded in the codebase to prevent future regressions.

Generated by OpenCVE AI on August 4, 2026 at 20:56 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-mqq6-462x-jxmm Go Restful API Boilerplate: Hardcoded JWT Secret "random" Allows Token Forgery
History

Wed, 05 Aug 2026 10:45:00 +0000

Type Values Removed Values Added
First Time appeared Dhax
Dhax go-base
Vendors & Products Dhax
Dhax go-base

Mon, 03 Aug 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Mon, 03 Aug 2026 19:45:00 +0000

Type Values Removed Values Added
Description go-base is a Go RESTful API Boilerplate template with JWT Authentication, backed by PostgreSQL. In versions prior to 2026-05-18, the JWT signing secret is hardcoded to the known string "random", letting any attacker who reads the public repository forge tokens for arbitrary users, including admin roles, and completely bypass authentication on all protected endpoints. This value is set in two places: the dev.env template (line 10) and a programmatic fallback in cmd/serve.go (line 35), so the application uses it even when no .env file is present. The original mitigation in auth/jwt/tokenauth.go (lines 22 to 25) only caught the exact string "random", letting other weak secrets through, and replaced it with an in-memory key that was not persisted, invalidating all tokens on every restart and effectively causing a denial-of-service. This issue has been fixed in version 2026-05-18.
Title Go Restful API Boilerplate: Hardcoded JWT Secret "random" Allows Token Forgery
Weaknesses CWE-798
References
Metrics cvssV3_1

{'score': 9.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-08-03T19:49:15.909Z

Reserved: 2026-05-20T18:15:53.577Z

Link: CVE-2026-48031

cve-icon Vulnrichment

Updated: 2026-08-03T19:49:12.256Z

cve-icon NVD

Status : Received

Published: 2026-08-03T20:17:24.200

Modified: 2026-08-03T20:17:24.200

Link: CVE-2026-48031

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-05T10:21:40Z

Weaknesses
  • CWE-798

    Use of Hard-coded Credentials