Skip to content

fix(auth): implement secure token validation and server-side CAPTCHA … - #270

Open
markuszaki wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
markuszaki:fix/owasp-auth
Open

markuszaki wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
markuszaki:fix/owasp-auth

Conversation

@markuszaki

Copy link
Copy Markdown

…(CWE-352/307/330)

Security fixes for authentication-related vulnerabilities:

CSRF (CWE-352):

  • Add hash_equals() for constant-time CSRF token comparison
  • Validate session tokens on all request levels (low/medium/high)
  • Generate session tokens after validation

CAPTCHA (CWE-307):

  • Remove backdoor bypass in high level (hidd3n_valu3 check)
  • Enforce strict server-side reCAPTCHA verification
  • No hardcoded bypass values accepted

Weak Session IDs (CWE-330):

  • Replace predictable counters/timestamps with random_bytes(32)
  • Add secure cookie flags: HttpOnly, Secure, SameSite=Strict
  • Use CSPRNG for all session token generation

Files changed:

  • vulnerabilities/csrf/source/{low,medium,high}.php
  • vulnerabilities/captcha/source/{low,medium,high}.php
  • vulnerabilities/weak_id/source/{low,medium,high}.php

…(CWE-352/307/330)

Security fixes for authentication-related vulnerabilities:

CSRF (CWE-352):
- Add hash_equals() for constant-time CSRF token comparison
- Validate session tokens on all request levels (low/medium/high)
- Generate session tokens after validation

CAPTCHA (CWE-307):
- Remove backdoor bypass in high level (hidd3n_valu3 check)
- Enforce strict server-side reCAPTCHA verification
- No hardcoded bypass values accepted

Weak Session IDs (CWE-330):
- Replace predictable counters/timestamps with random_bytes(32)
- Add secure cookie flags: HttpOnly, Secure, SameSite=Strict
- Use CSPRNG for all session token generation

Files changed:
- vulnerabilities/csrf/source/{low,medium,high}.php
- vulnerabilities/captcha/source/{low,medium,high}.php
- vulnerabilities/weak_id/source/{low,medium,high}.php
@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

🏆 DVWA — CTF Patch Score

██░░░░░░░░░░░░░░░░░░  12 / 108 pts  (11%)

6 / 55 challenges patched

Per-challenge detail is withheld — it would reveal the rubric.

Commit: e930a1a · scoring run

🎉 Your result is on the leaderboard — see where you rank! 🏆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant