{"id":30983,"date":"2016-01-13T13:01:04","date_gmt":"2016-01-13T07:31:04","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=30983"},"modified":"2016-12-19T15:02:52","modified_gmt":"2016-12-19T09:32:52","slug":"malicious-exploitation-of-unauthenticated-request-submissions","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/malicious-exploitation-of-unauthenticated-request-submissions\/","title":{"rendered":"Malicious exploitation of Unauthenticated Request submissions"},"content":{"rendered":"<p><span style=\"color: #000000\">During a recent penetration test on one of our client&#8217;s application, we came across a case of malicious file propagation through the application server. The attack does not require an authenticated session. The vulnerable section is accessible by unauthenticated users. The attack involves an attacker submitting a malicious request (a malicious file is uploaded by the attacker) on behalf of anyone (victim) whose email id is known to the attacker. Once the attacker targets a victim, the victim receives an email about the query made by the attacker. The victim, though puzzled(&#8220;When did I make such a request?&#8221;), clicks on the email and downloads the file uploaded by the attacker and the file does whatever evil actions it was meant to perform. Thus, it is a\u00a0<strong>Malicious exploitation of Unauthenticated Request submissions.<\/strong><\/span><\/p>\n<p><span style=\"color: #000000\">The details of the attack, root cause, logical issue and remediation are explained in the later sections of the blog.<\/span><\/p>\n<h3><span style=\"color: #ff9900\">Scenario:<\/span><\/h3>\n<p><span style=\"color: #000000\">Suppose Andrew is the victim and Bill is the attacker and the affected domain is support.example.com. Bill visits the URL  and submits a support request to the example application. The submission includes a malicious file (as there is no restriction on the type of file uploaded). The request subject says, <strong>\u201cThanks for the recent purchase and Bank account details submission\u201d<\/strong> which will provoke the user to see the support request submission. The report details will lure the user into downloading the attached file by saying <strong>\u201cI have a made a recent purchase of 50$ for a product at your store. And the same failed and hence I requested a refund of my amount. But there seems to be no transaction from your end and hence, I am uploading my bank account statement for the same. I have updated my account details in my user profile as well\u201d<\/strong>. The attached file will be a malicious file say BankStatement.pdf. This file can be a web attack vector that might enable Bill to gain complete control over Andrew&#8217;s machine once Andrew has downloaded the file. The same method can be used to spread malwares using example&#8217;s server as a medium.<\/span><\/p>\n<p><span style=\"color: #000000;line-height: 1.71429;font-size: 1rem\">* Bill just needs Andrew&#8217;s email address to make this attack successful.<\/span><\/p>\n<h6><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-31316\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/01\/Mail.png\" alt=\"Mail\" width=\"837\" height=\"428\" \/><br \/>\n<span style=\"color: #000000\">*Portions of the screenshot have been intentionally blurred following the practice of the Responsible disclosure.<\/span><\/h6>\n<h3><span style=\"color: #ff9900\">Payload used in this attack<\/span><\/h3>\n<p><span style=\"color: #000000\">We have used a malicious PDF file created using Metasploit,\u00a0a tool for developing and executing exploit\u00a0code. A screenshot of the report of the malicious PDF done from an online scanner:<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-31318 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/01\/Evil_pdf_report.png\" alt=\"Evil_pdf_report\" width=\"837\" height=\"679\" \/><\/p>\n<h3><span style=\"color: #ff9900\">Root Cause: Unrestricted File upload<\/span><\/h3>\n<ul>\n<li><span style=\"color: #000000\">Malicious file propagation through example\u00a0portal<\/span><\/li>\n<li><span style=\"color: #000000\">Unauthenticated access to the Support request submission portal \/ anonymous report submission allowed on the domain<\/span><\/li>\n<\/ul>\n<h3><span style=\"color: #ff9900\">Logical issue with this bug<\/span><\/h3>\n<p><span style=\"color: #000000\">The application allows anyone to create a support ticket anonymously. To worsen the case, one can also create a support ticket on someone else&#8217;s behalf just by entering the email address of the victim in the support ticket form.\u00a0An attacker may exploit this issue, by creating a ticket on victim&#8217;s behalf and attaching a malicious file (pdf\/doc\/exe) in the ticket. As per the working of the application, the victim will receive an email (provided by attacker while creating ticket) mentioning about the ticket details and a link of the uploaded file. Now, the attacker may form the text of ticket in such a way that it provokes the victim to download the file.\u00a0<\/span><br \/>\n<span style=\"color: #000000\"> This vulnerability also allows unrestricted file upload which allows arbitrary file upload to the server and the same to attack the end-users (victim). Unrestricted file upload is itself a discrete issue alongside the logical bug mentioned in the above paragraph. The combination of the two bugs allows this chain of attacks to happen.<\/span><\/p>\n<h3><span style=\"color: #ff9900\">Remediation<\/span><\/h3>\n<ul>\n<li><span style=\"color: #000000\">Unrestricted file upload should not be present on the application.<\/span><br \/>\n<span style=\"color: #000000\">There should be restriction of file types that can be uploaded, maximum file size that can be uploaded, restriction on file uploads of null size and blocking dangerous extensions such as .exe or .sh, blocking double extensions,\u00a0Preventing access to\u00a0the upload folder with .htaccess, do not allow\u00a0overwrite of existing files<\/span><\/li>\n<li><span style=\"color: #000000\">Also, the application should only allow posting the support request form after authenticating the user. This will prevent the attacker from posting support requests on the behalf of users(victim).<\/span><\/li>\n<li><span style=\"color: #000000\">A precautionary measure should be included in the e-mail: The mail containing the \u201csubmission\u201d intimation should contain a cautionary message stating that \u201cIf it was not you, click to remove\/review the submission\u201d. This would trigger the genuine user to check for the malicious submission done on his behalf. <\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>During a recent penetration test on one of our client&#8217;s application, we came across a case of malicious file propagation through the application server. The attack does not require an authenticated session. The vulnerable section is accessible by unauthenticated users. The attack involves an attacker submitting a malicious request (a malicious file is uploaded by [&hellip;]<\/p>\n","protected":false},"author":166,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":6},"categories":[2026,1],"tags":[2957,2956,2953,71,2958,2959,2955,2952,2954,901],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/30983"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/166"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=30983"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/30983\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=30983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=30983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=30983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}