Skip to content

fix(crypto-csp): use CSPRNG and strict CSP headers to prevent cryptog… - #272

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

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

Conversation

@markuszaki

Copy link
Copy Markdown

…raphic failures (CWE-327/79/602)

Security improvements:

  • Cryptography: Replace weak XOR/AES-ECB with AES-256-GCM authenticated encryption
  • Use random_bytes() for all cryptographic random generation
  • CSP: Implement strict nonce-based Content Security Policy headers
  • Remove unsafe-inline, unsafe-eval, and dangerous external script sources
  • JavaScript: Move all validation from client-side to server-side
  • Remove obfuscated JavaScript and client-side token generation
  • Eliminate JSONP endpoints which are inherently vulnerable to CSP bypass

Files modified:

  • vulnerabilities/cryptography/source/{low,medium,high}.php
  • vulnerabilities/cryptography/source/token_library_high.php
  • vulnerabilities/csp/source/{low,medium,high}.php
  • vulnerabilities/javascript/source/{low,medium,high}.php

Addresses: CWE-327 (Cryptographic Issues), CWE-79 (XSS), CWE-602 (Client-Side Enforcement)

…raphic failures (CWE-327/79/602)

Security improvements:
- Cryptography: Replace weak XOR/AES-ECB with AES-256-GCM authenticated encryption
- Use random_bytes() for all cryptographic random generation
- CSP: Implement strict nonce-based Content Security Policy headers
- Remove unsafe-inline, unsafe-eval, and dangerous external script sources
- JavaScript: Move all validation from client-side to server-side
- Remove obfuscated JavaScript and client-side token generation
- Eliminate JSONP endpoints which are inherently vulnerable to CSP bypass

Files modified:
- vulnerabilities/cryptography/source/{low,medium,high}.php
- vulnerabilities/cryptography/source/token_library_high.php
- vulnerabilities/csp/source/{low,medium,high}.php
- vulnerabilities/javascript/source/{low,medium,high}.php

Addresses: CWE-327 (Cryptographic Issues), CWE-79 (XSS), CWE-602 (Client-Side Enforcement)
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

🏆 DVWA — CTF Patch Score

█░░░░░░░░░░░░░░░░░░░  6 / 108 pts  (6%)

3 / 55 challenges patched

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

Commit: 3ba15e6 · 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