JavaScript
Many CTF web challenges rely on JavaScript for client‑side validation, obfuscation, or logic hiding. Understanding and reversing it can reveal hidden cryptographic routines, flag validators, or exploitable vulnerabilities (like prototype pollution).
| Task | Tool / Method |
|---|---|
| Deobfuscate JS | de4js, JavaScript Deobfuscator |
| Analyze Obfuscator.io output | Obfuscator.io Deobfuscator |
Scan package-lock.json for vulnerable packages |
npm audit |
| Alternative vulnerability scanner | Snyk CLI |
JavaScript challenges often contain obfuscated logic meant to slow down analysis or hide flags. Several tools can unpack and beautify code automatically:
| Tool | Description |
|---|---|
| de4js | Browser-based universal JS deobfuscator |
| deobfuscate.io | Online service to unpack obfuscator‑style JS |
| Obfuscator.io Deobfuscator | Specialized tool for reversing obfuscator.io output |
| JSNice | AI-based beautifier with variable name recovery |
If a package-lock.json or yarn.lock file is exposed, you can scan dependencies for security issues:
npm audit
Example output:
# npm audit report
ion-parser *
Severity: critical
ion-parser Prototype Pollution when malicious INI file submitted to application that parses with `parse` - https://github.com/advisories/GHSA-7vrv-5m2h-rjw9
fix available via `npm audit fix`
node_modules/ion-parser
1 critical severity vulnerability
Alternative scanners:
Prototype Pollution lets attackers modify an object’s __proto__, influencing all derived objects which can lead to RCE in certain contexts.
Example vulnerable code:
const merge = require('deepmerge');
let obj = {};
let payload = '{"__proto__": {"polluted": true}}';
let result = merge(obj, JSON.parse(payload));
console.log(obj.polluted); // true
The payload pollutes the base prototype, giving every object a new polluted property.
In real attacks, this can corrupt configuration data or inject arbitrary code paths.
- Use DevTools Pretty Print to quickly format JavaScript in the browser.
- In CTFs, search for suspicious variable names or encoded strings (
atob,btoa,fromCharCode). - If a script performs Base64 decoding or XOR operations, reverse it using Node.js or Python to extract the hidden flag.