Skip to content
DoS Write-up Beginner

With a single request, you can kill any Gitea server

A Gitea issue comment containing many emojis caused excessive back-end text formatting, driving CPU usage high and making the server unresponsive. An attacker could send a single request with many emojis to deny service to the Gitea instance.

Khaled Nassar Follow

Published on medium.com

in this blog I’m going to tell you how I was able to kill/dos any Gitea server I discovered this bug in Gitea version 1.14.2 in 2021

Khaled Nassar, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 3 min read.

Context

Gitea is a self-hosted Git service with an issue tracker, and the issue body accepts emojis. The researcher found a way to make a single request to that issue body API consume enough server-side formatting work that the instance stops responding.

The affected version is Gitea 1.14.2, found in 2021 and fixed in 1.14.3. The researcher was not targeting Gitea directly: he was bug bounty hunting on a private target whose staging host, staging-dev.target.com, was running Gitea.

Setup

  1. The target was a private bug bounty programme, with a Gitea instance on a staging subdomain.
  2. The researcher first looked for known CVEs for the product. He found some, but the proof of concept was not included in the CVE report, only the pull request on GitHub.
  3. He then searched the repositories on the server for private keys and found none.
  4. He created an account on the Gitea server, hoping an authenticated user might be able to make repositories private. After creating the account he saw no difference.
  5. As a last option he decided to send emojis to Gitea's issues page, for trolling or joking.
  6. The tool used for the requests was ZAP (Zaproxy).

The environment he later reported to the Gitea team:

Finding it

He opened ZAP and sent many emojis to the issues body API in one request. Afterwards he noticed the subdomain's response time going up, then got a 500 error, and the server was not responding when he tried to visit the Gitea issue he had opened.

When he reported it to the target's security team, the response was fast: they said it was not part of their products and asked him to forward the report to the Gitea security team. They did provide material for a good report, including logs and screenshots of CPU usage.

Exploitation

Step 1: send many emojis in one issue body request

Using ZAP, he sent a large number of emojis to the issues body API in a single request. The report does not reproduce the exact request, the endpoint path or the payload, so the precise body is not available here.

Step 2: observe the effect

After the request, the subdomain's response time increased, the request returned a 500 error, and visiting the issue he had opened hung because the server was not responding.

Step 3: confirm the trigger

When someone visits the Gitea issue containing the emojis, CPU usage gets high. The researcher's explanation is that too much text formatting and processing happens in the back end for the comment.

Root cause

The back end performs too much text formatting and processing on the comment. A body containing a very large number of emojis makes that processing expensive, and CPU usage gets high whenever someone visits the issue. The report does not name the specific function or code path; the fix is in go-gitea/gitea#16185.

Impact

An attacker with the ability to post an issue can make a Gitea instance stop responding, and CPU usage gets high whenever anyone views the issue. In this case the researcher had created an account on the target's server. The report does not state whether unauthenticated users can reach the same code path.

Fix

The bug was fixed in Gitea 1.14.3 by the Gitea team. The fix pull request is go-gitea/gitea#16185, and the researcher's name appears on the release page for that release: https://blog.gitea.io/2021/06/gitea-1.14.3-is-released/

Variants to test

  1. Other fields that are rendered on every view, such as issue comments. A positive result is a rise in response time and CPU when the content is rendered.
  2. Other emoji or text syntax that triggers server-side processing. A positive result is the same slowdown from a single submission.
  3. Repeated rendering of the same stored content by multiple viewers. A positive result is CPU usage climbing with each visit rather than only at submission time.
  4. The same payload against a current release on a test instance such as try.gitea.io, to check whether the fix covers the whole class of inputs. A positive result is a 500 error or a hang on a version after 1.14.3.
A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store From the original on medium.com
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

What happened, in plain words

A security researcher was hunting for bugs on a private bug bounty programme. A bug bounty programme is a scheme where an organisation invites people to look for security problems in its systems and pays them for reporting what they find. The target had a test copy of its website, called a staging server, and that test copy was running a piece of software called Gitea.

Gitea is a free, self-hosted Git service. Git is the tool developers use to keep track of changes to code, and a Git service is a website that stores those code projects online so a team can share them. Gitea also has an issue tracker: a place where people write notes about bugs or tasks, and each note is called an issue. The text of an issue accepts emojis, which the server processes when the page is displayed.

The researcher discovered that he could send one single request to the part of Gitea that saves the text of an issue, with a huge number of emojis in it, and that this would make the server work so hard that it stopped responding. The affected version was Gitea 1.14.2, found in 2021 and fixed in 1.14.3.

This kind of problem is called a denial of service, often shortened to DoS. A denial of service is when an attacker makes a service unavailable to its normal users, not by stealing data but by exhausting its resources. A useful comparison is a shop with one cashier: if someone stands at the counter asking thousands of tiny questions, real customers cannot get served, even though nothing has been stolen.

Setting the scene

  1. The target was a private bug bounty programme, with a Gitea instance on a staging subdomain. A subdomain is a name that sits under a main domain, like staging-dev.target.com under target.com, and staging is a copy of a site used for testing before changes go live.
  2. The researcher first looked for known CVEs for the product. A CVE is a publicly catalogued security vulnerability, each one given an identifier so people can refer to it. He found some, but the proof of concept was not included in the CVE report, only the pull request on GitHub. A proof of concept, or PoC, is a small demonstration that shows a bug can actually be triggered. A pull request is a proposed change to a code project, which other developers review before it is merged.
  3. He then searched the repositories on the server for private keys and found none. A repository is a stored code project, and a private key is a secret file used to prove identity or decrypt data, so finding one lying around would be a serious leak.
  4. He created an account on the Gitea server, hoping an authenticated user might be able to make repositories private. Authenticated means logged in with a valid account. After creating the account he saw no difference.
  5. As a last option he decided to send emojis to Gitea's issues page, for trolling or joking.
  6. The tool used for the requests was ZAP (Zaproxy). ZAP is a free tool that sits between your browser and a website, letting you capture a request, change it, and send it again, which is how testers try variations quickly.

The environment he later reported to the Gitea team:

A database is the program where a site stores its data, and MySQL is one common database program. A version number identifies exactly which release of a piece of software is running, which matters because a bug may exist in one release and be fixed in the next. Reproducible means the same steps produce the same result again, which is what makes a bug report useful.

Finding it

He opened ZAP and sent many emojis to the issues body API in one request. An API is the part of a website that accepts data and instructions from a program rather than from a person clicking buttons; the issues body API is the address that receives the text of an issue when it is saved. Afterwards he noticed the subdomain's response time going up, then got a 500 error, and the server was not responding when he tried to visit the Gitea issue he had opened. Response time is how long the server takes to answer a request, and a 500 error is the standard code a web server returns when something has gone wrong on its side.

When he reported it to the target's security team, the response was fast: they said it was not part of their products and asked him to forward the report to the Gitea security team. They did provide material for a good report, including logs and screenshots of CPU usage. Logs are the records a server keeps of what happened, and CPU usage is how much of the computer's processing power is being used at a given moment.

Exploitation

Step 1: send many emojis in one issue body request

Using ZAP, he sent a large number of emojis to the issues body API in a single request. The report does not reproduce the exact request, the endpoint path or the payload, so the precise body is not available here. An endpoint is the specific address on a server that handles one kind of action, and a payload is the data you send to it.

Step 2: observe the effect

After the request, the subdomain's response time increased, the request returned a 500 error, and visiting the issue he had opened hung because the server was not responding. Hanging means the page never finishes loading, because the server never sends an answer.

Step 3: confirm the trigger

When someone visits the Gitea issue containing the emojis, CPU usage gets high. The researcher's explanation is that too much text formatting and processing happens in the back end for the comment. The back end is the part of a website that runs on the server, as opposed to the front end, which is what you see in your browser. The important detail is that the cost is paid every time the page is viewed, not only when it is saved.

Root cause

The back end performs too much text formatting and processing on the comment. Resolving a shortcode means replacing the short text code with the actual emoji picture before the page is shown. A body containing a very large number of emojis makes that processing expensive, and CPU usage gets high whenever someone visits the issue. Rendering is the act of turning stored text into the finished page a visitor sees. The report does not name the specific function or code path; the fix is in go-gitea/gitea#16185.

Impact

An attacker with the ability to post an issue can make a Gitea instance stop responding, and CPU usage gets high whenever anyone views the issue. In this case the researcher had created an account on the target's server. The report does not state whether unauthenticated users can reach the same code path.

Fix

The bug was fixed in Gitea 1.14.3 by the Gitea team. The fix pull request is go-gitea/gitea#16185, and the researcher's name appears on the release page for that release: https://blog.gitea.io/2021/06/gitea-1.14.3-is-released/

Variants to test

These are follow-up ideas in the same spirit, for anyone who wants to check whether the same weakness appears elsewhere.

  1. Other fields that are rendered on every view, such as issue comments. A positive result is a rise in response time and CPU when the content is rendered.
  2. Other emoji or text syntax that triggers server-side processing. A mention is a way of writing another person's name so the site links to them. A positive result is the same slowdown from a single submission.
  3. Repeated rendering of the same stored content by multiple viewers. A positive result is CPU usage climbing with each visit rather than only at submission time.
  4. The same payload against a current release on a test instance such as try.gitea.io, to check whether the fix covers the whole class of inputs. A positive result is a 500 error or a hang on a version after 1.14.3.
A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store From the original on medium.com
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

Glossary

  • API: the part of a website that accepts data and instructions from a program rather than from a person clicking buttons.
  • Authenticated: logged in with a valid account.
  • Back end: the part of a website that runs on the server, as opposed to the front end you see in the browser.
  • Bug bounty programme: a scheme where an organisation invites people to find security problems in its systems and rewards them for reporting them.
  • CPU usage: how much of a computer's processing power is being used at a given moment.
  • CVE: a publicly catalogued security vulnerability, each one given an identifier.
  • Database: the program where a site stores its data.
  • Denial of service (DoS): making a service unavailable to its normal users by exhausting its resources.
  • Endpoint: the specific address on a server that handles one kind of action.
  • Gitea: a free, self-hosted Git service with an issue tracker.
  • Git: the tool developers use to keep track of changes to code.
  • Hanging: a page that never finishes loading because the server never answers.
  • Issue: a note in a tracker describing a bug or task.
  • Issue tracker: a place where a team records bugs and tasks.
  • Logs: the records a server keeps of what happened.
  • Markdown: a simple way of formatting text using plain characters.
  • Mention: writing another person's name so the site links to them.
  • MySQL: a common database program.
  • Payload: the data you send to an endpoint.
  • Proof of concept (PoC): a small demonstration that shows a bug can actually be triggered.
  • Pull request: a proposed change to a code project, reviewed before it is merged.
  • Rendering: turning stored text into the finished page a visitor sees.
  • Repository: a stored code project.
  • Reproducible: the same steps produce the same result again.
  • Response time: how long a server takes to answer a request.
  • 500 error: the standard code a web server returns when something has gone wrong on its side.
  • Staging server: a copy of a site used for testing before changes go live.
  • Subdomain: a name that sits under a main domain, such as staging-dev.target.com under target.com.
  • Version number: the label identifying exactly which release of a piece of software is running.
  • ZAP (Zaproxy): a free tool that sits between your browser and a website so you can capture, change and resend requests.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.