There is a SQL Injection in the "profile" function of piwigo #1668

Closed
opened 2026-10-05 00:52:21 +02:00 by adam · 0 comments
Owner

Accessing the 'profile' page
image

Add the 'user_id' parameter with single quotes
image

Discovering an error in MySQL can actually prove the existence of SQL injection, but we can still try using the sleep() function for testing
image
image

//Try to analyze how this vulnerability was generated from a code level perspective.
image

First find '/admin/profile.php'
image

Track build_user() function (in the /Piwigo/include/functions_user.inc.php)
image

The '$user_id' enters the getuserdata() function, so continue tracking getuserdata()
image

Finally, the '$user_id' variable will enter this string of SQL statements, which clearly does not filter the incoming parameter values, resulting in SQL injection
image

This vulnerability affects the latest version up to 13.6.0, and it is uncertain whether other versions will be affected.

Accessing the 'profile' page ![image](https://user-images.githubusercontent.com/27283436/236197441-196a43d0-f0ba-43ac-9448-f029bec196c7.png) Add the 'user_id' parameter with single quotes ![image](https://user-images.githubusercontent.com/27283436/236197644-ae97d84c-4296-4721-aa16-b21665c9500e.png) Discovering an error in MySQL can actually prove the existence of SQL injection, but we can still try using the sleep() function for testing ![image](https://user-images.githubusercontent.com/27283436/236197884-f0ce2eba-c8f8-4149-b00d-d749df754b5a.png) ![image](https://user-images.githubusercontent.com/27283436/236197944-08f57be8-55a0-4f3b-b0f0-5c9a817a38a5.png) //Try to analyze how this vulnerability was generated from a code level perspective. ![image](https://user-images.githubusercontent.com/27283436/236198160-a60843de-6d4d-4387-8a11-d1859ddcdb4d.png) First find '/admin/profile.php' ![image](https://user-images.githubusercontent.com/27283436/236198316-b51f7340-abce-4fa1-8140-237b263485dd.png) Track build_user() function (in the /Piwigo/include/functions_user.inc.php) ![image](https://user-images.githubusercontent.com/27283436/236198585-aef18e94-9fa6-49fc-ba1f-f6c4d66cec17.png) The '$user_id' enters the getuserdata() function, so continue tracking getuserdata() ![image](https://user-images.githubusercontent.com/27283436/236200448-87f3c1ab-eeb8-4fdb-8fb6-2595fa2a8b18.png) Finally, the '$user_id' variable will enter this string of SQL statements, which clearly does not filter the incoming parameter values, resulting in SQL injection ![image](https://user-images.githubusercontent.com/27283436/236200578-779570be-22ca-4459-8c2f-66fbbc2369ad.png) This vulnerability affects the latest version up to 13.6.0, and it is uncertain whether other versions will be affected. <!-- github-sync-id:1695904246 -->
adam closed this issue 2026-10-05 00:52:21 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1668