Arbitrary file deletion in Gitea in go-gitea/gitea
Reported on
Mar 12th 2022
Description
When user delete the LFS data in Gitea, the oid
parameter is not been validated. The attacker can make an oid whose prefix is ....
to traverse directory and delete any files on the server.
Proof of Concept
Create a repository on Gitea. (e.g. foo/bar
)
Send a POST request with your Gitea cookies and set CSRF token in request body.
POST /foo/bar/settings/lfs/delete/....%2fcustom%2fconf%2fapp.ini
The Gitea configuration custom/conf/app.ini
has been deleted.
Impact
This vulnerability is capable of deleting the files on the server, which allows the attacker to make the service unavailable. With deleting the Gitea configuration file, the attacker can reinstall the entire program after restarting.
Thanks for this report, we've resolved this in https://github.com/go-gitea/gitea/pull/19072
We are writing the blog post right and and will be crediting your username (and huntr.dev too), please let us know if you'd prefer a different credit other than your username.
Thanks.
Could you please use E99p1ant
as the credit name? And here is my GitHub profile: https://github.com/wuhan005
Hi, I noticed that the blog post has been released. It seems like my username is missing in the post. 😂
https://gitea.com/gitea/blog/pulls/188 will fix that.