Summary
A broken access control vulnerability on the /console/api/apps/<APP_ID>chat-messages?conversation_id=<CONVERSATION_ID>&limit=10 endpoint allows users in the same workspace to read chat messages of other users.
Details and PoC
The following vulnerability was discovered using two user accounts on a local docker deployment of Dify with standard settings on version 1.8.1.
First an admin account was created as 'Felix' .
Than a second user was added as a normal user called 'HackerNormal'.
Then the file translation app was created by the Admin user. This vulnerability is probably not dependent on a specific app, though.
After publishing and running the app, the following chat was created by the admin user:
Visiting the Admin panel of the app via http://localhost/app/53e60499-0d3b-4d08-bc07-06c4875023c3/logs Admins can see the logs of all chats to this app.
Using the regular User 'HackerNormal' this page is not accessible.
Now looking at the traffic generated when visiting this site with an admin user and clicking on a specific chat to open it,
the following request is triggered:
GET /console/api/apps/53e60499-0d3b-4d08-bc07-06c4875023c3/chat-messages?conversation_id=d5177fc7-d200-47e4-b70b-6950eec500ff&limit=10 HTTP/1.1
Host: localhost
sec-ch-ua-platform: "Linux"
authorization: Bearer <Bearer Token of The Admin>
Returning the query and the filename of the Admin user in .json:
...
"filename":"documentToTranslate.txt",
...
"query":"This is a secret chat by the Admin user!",
...
The problem now is that this request can also be send with the Bearer token of the regular User and will yield the same as result as if sending it with the admin users token.
Impact
A regular user is able to read the query data and the filename of the admins and probably other users chats, if they know the conversation_id. This impacts the confidentiality of chats. Impact, when using apps other then the file upload app was not examined in this assessment.
Assuming that all chats can be read this way, the impact on confidentiality was set to high.
Impact on Other Versions
This was only tested in 1.8.1 and is potentially impacting all versions that have this endpoint enabled.
Summary
A broken access control vulnerability on the
/console/api/apps/<APP_ID>chat-messages?conversation_id=<CONVERSATION_ID>&limit=10endpoint allows users in the same workspace to read chat messages of other users.Details and PoC
The following vulnerability was discovered using two user accounts on a local docker deployment of Dify with standard settings on version 1.8.1.
First an admin account was created as 'Felix' .
Than a second user was added as a normal user called 'HackerNormal'.
Then the file translation app was created by the Admin user. This vulnerability is probably not dependent on a specific app, though.
After publishing and running the app, the following chat was created by the admin user:
Visiting the Admin panel of the app via
http://localhost/app/53e60499-0d3b-4d08-bc07-06c4875023c3/logsAdmins can see the logs of all chats to this app.Using the regular User 'HackerNormal' this page is not accessible.
Now looking at the traffic generated when visiting this site with an admin user and clicking on a specific chat to open it,
the following request is triggered:
Returning the query and the filename of the Admin user in .json:
The problem now is that this request can also be send with the Bearer token of the regular User and will yield the same as result as if sending it with the admin users token.
Impact
A regular user is able to read the query data and the filename of the admins and probably other users chats, if they know the conversation_id. This impacts the confidentiality of chats. Impact, when using apps other then the file upload app was not examined in this assessment.
Assuming that all chats can be read this way, the impact on confidentiality was set to high.
Impact on Other Versions
This was only tested in 1.8.1 and is potentially impacting all versions that have this endpoint enabled.