Commit 524e10a
authored
Fix Stored XSS Vulnerability in Debug Toolbar (debugbar_time Parameter)!!
This PR addresses a stored XSS vulnerability in the Toolbar.php file of the Debug Toolbar system. The issue arises from improper sanitization and validation of the debugbar_time GET parameter, which is used to construct file paths and read their contents. If an attacker injects malicious JavaScript into a debugbar_*.json file, it could be executed when the debug toolbar is accessed, leading to potential security risks.
Issue Details:
Vulnerability:
The debugbar_time parameter was not properly validated, allowing attackers to inject malicious payloads.
The file contents were directly echoed back to the client without escaping, enabling stored XSS attacks.
Impact:
Session Hijacking: Attackers could steal session cookies of admins or users.
Persistent Malware Injection: Malicious scripts could persist in the debug logs and execute whenever accessed.
Privilege Escalation: If executed in a privileged session, attackers could perform unauthorized actions.
Fix Implemented:
1 . Input Validation: Added a preg_match() check to ensure the debugbar_time parameter only contains alphanumeric characters and underscores (^[a-zA-Z0-9_]+$).
This prevents malicious input from being used to construct file paths.
2. Output Escaping: Used htmlspecialchars() to escape special characters (<, >, ", ', &) in the file contents before echoing them back to the client.
This ensures that any potentially malicious content is rendered harmless in the browser.
3. File Existence and Readability Check:Added a check to ensure the file exists and is readable (is_file() and is_readable()) before attempting to read its contents.
Please review and merge this PR to address the security vulnerability.1 parent 7a177dd commit 524e10a
1 file changed
+8
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
487 | 493 | | |
488 | 494 | | |
489 | 495 | | |
490 | 496 | | |
491 | 497 | | |
492 | 498 | | |
493 | 499 | | |
494 | | - | |
| 500 | + | |
495 | 501 | | |
496 | | - | |
| 502 | + | |
497 | 503 | | |
498 | 504 | | |
499 | 505 | | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
| |||
0 commit comments