fix(auth): implement secure token validation and server-side CAPTCHA … - #270
Open
markuszaki wants to merge 1 commit into
Open
markuszaki wants to merge 1 commit into
markuszaki wants to merge 1 commit into
Conversation
…(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
🏆 DVWA — CTF Patch Score6 / 55 challenges patched
Commit: 🎉 Your result is on the leaderboard — see where you rank! 🏆 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…(CWE-352/307/330)
Security fixes for authentication-related vulnerabilities:
CSRF (CWE-352):
CAPTCHA (CWE-307):
Weak Session IDs (CWE-330):
Files changed: