The JavaScript Footgun in a Single Tweet
Description
This image is a screenshot of a tweet from Dan Abramov (@dan_abramov), a prominent developer in the JavaScript and React communities. The tweet contains a single, highly consequential line of JavaScript code: 'console.log = eval'. This is a piece of 'cursed' code humor that is deeply resonant for experienced developers. It works by taking the most common and trusted debugging function, `console.log`, which simply prints messages, and reassigning it to `eval`, a powerful and dangerous function that executes any string as code. The joke is that this simple reassignment turns a harmless diagnostic tool into a massive security vulnerability. Any developer trying to debug by logging a variable or a message would instead be executing that data as code, potentially leading to catastrophic application behavior or remote code execution (RCE) if the logged data comes from an external source. It's a perfect one-line horror story for programmers, funny because of its elegant simplicity and disastrous implications
Comments
19Comment deleted
Some developers ship bugs. True chaos merchants ship `console.log = eval` and wait for the bug reports to execute themselves
Assigning `console.log = eval` is like porting Log4Shell to JavaScript - congrats, your debug prints now double as both observability and exit interview
This is the JavaScript equivalent of replacing your smoke detector with a flamethrower - technically it'll still make noise when there's a problem, but now it's also the problem. Perfect for when you want your logging statements to have the same security posture as a 2003 PHP guestbook
Finally, a logging framework where 'log injection' is the feature, not the CVE
Ah yes, the classic 'console.log = eval' - because why merely observe your code's behavior when you can turn every debugging statement into a potential RCE? It's like replacing your smoke detector with a flamethrower. This is the kind of 'optimization' that makes security teams age in dog years and turns code reviews into intervention sessions. Perfect for when you want your logging framework to double as a footgun with a hair trigger
console.log = eval - congrats, you just turned observability into a write path and your logs into RCE
Alias console.log to eval and congrats - you just built RCE-as-observability; every 'harmless' log line now doubles as a deployment pipeline
console.log = eval; because nothing screams 'senior dev wisdom' like one-lining your way into OWASP glory
*INSANE SCREAM* Comment deleted
Based Comment deleted
🙄🙄 Comment deleted
A js hack?! Comment deleted
Evil Comment deleted
2-month old joke, cringe Comment deleted
Log4j Comment deleted
Just get it after seeing your comment 😅 It is really a late joke. Comment deleted
Thats a risk one Comment deleted
What risks does such code give? Comment deleted
If this is a nodejs application, console.log can execute any codes you pass to it. You can run a child process inside the node and do anything you want, such as executing shell script. Comment deleted