DoS via payload in git config --global user.name
A user with commit access could set an extremely long git user name, causing the project's branches page to return a 503 error and, if pushed to the default branch, making the entire repository unavailable. The attacker could deny access to the project for all users.
GitLab
Originally disclosed on GitLab
- Fixed in 10 months
- Disclosed after 10 months
HackerOne report #987689 by stanlyoncm on 2020-09-21, assigned to @dcouture:
Report | Attachments | How To Reproduce
NOTE: The report was sent in Spanish. TL;DR is that a commit from a user with a really long name makes the /-/branches page unreachable. If the commit is pushed directly to master it breaks the entire repository. See the How To Reproduce section below.
Report
==Report in Spanish:==
Summary
Un atacante miembro de un proyecto, podría causar una denegación de servicio en la rama del proyecto en gitlab.com al realizar un cometer desde el emulador de terminal por medio del comando git, el atacante, es capaz de realizar este ataque al colocar una carga útil en el valor de nombre en git config --global user.name
El impacto del DoS depende de los permisos que tenga el atacante dentro del proyecto a mayor permiso, mayor será el impacto del ataque.
Un atacante con permisos de Mantenedor podrá causar el DoS en la rama maestra del proyecto, afectando las ramas de nivel inferior al no poder acceder a /branches (notara esto en el video de domostracion).
Un atacante con permisos de Desarrollo podrá causar el DoS en gitlab.com en cualquier rama que no sea maestra, esto ya que no puede hacer push sobre el origin/master
Steps to reproduce
[Preparacion]
Para este proyecto y la demostración en video, se realizo el ataque en la rama maestra del proyecto, por lo que deberá invitar a un miembro con permisos de Mantenedor
__1)__Cree un nuevo proyecto y agregue un nuevo miembro con permisos de mantenedor.
[Flujo del ataque] (miembro invitado con permisos de mantenedor)
__1)__Desde el emulador de terminal establezca su nombre de usuario y correo electrónico.
__2)__Clone el proyecto.
__3)__Realice una confirmación de prueba (opcional).
__4)__Coloque el archivo name.txt (adjunto:) un nivel por debajo del proyecto que acaba de clonar.
__5)__Utilice el siguiente comando para agregar el valor name.txt al nombre de usuario: name=$(cat ../name.txt) && git config --global user.name "$name"
__6)__Ahora realice algún cambio en el proyecto y realice un comiter con el nuevo nombre de usuario.
__7)__Haga git push sobre la rama maestra.
Ahora cualquier persona que visite la pagina principal del proyecto en gitlab.com, se encontrara con la ruta 404 indicando que la pagina no se encuentra, si accede a https://gitlab.com/user/project/-/branches se encontrara con la ruta 503 indicando que gitlab no esta disponible.
What is the current bug behavior?
Denegación de servicio al acceder al proyecto a través de gitlab.com, a través de de una carga útil colocada en el nombre de usuario
What is the expected correct behavior?
El proyecto debería ser accesible a través de gitlab.com tras cualquier confirmación o cometer de usuario.
Relevant logs and/or screenshots


Output of checks
This bug happens on GitLab.com
Poc
Impact
Todos los usuarios no podrán acceder al proyecto o a las ramas a través de gitlab.com
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
How To Reproduce
Please add reproducibility information to this section:
Clone a repository (victim) that you're a developer (attacker) on and run the following commands:
git checkout -b dostest
git config user.name "$(ruby -e 'puts "name" * 20000')"
echo test >> README.md
git add README.md
git commit -m dos
git push --set-upstream origin dostest
At this point the /-/branches page is unreachable with 503.
If the repository enables developers to push to master (or if the maintainer does so) the entire repository becomes unavailable, even the settings pages.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application does not limit the length of the git user name when rendering commit information, causing a server error when the name is excessively long.
Impact
All users could be unable to access the project or its branches through gitlab.com, and if the default branch is affected the entire repository becomes unavailable.
What the attacker needed
A GitLab account; developer or maintainer access to a project
How it was found
- Clone a repository where you have developer access.
- Create a new branch.
- Set a very long git user name.
- Make a commit and push the branch.
- The branches page becomes unreachable with a 503 error.
- If pushed to the default branch, the entire repository becomes unavailable.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Git attaches a display name to each commit. If that name is extremely long, GitLab's branches page can fail to load with an error, and pushing to the default branch can make the whole repository unavailable.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.