Skip to content
DoS Write-up Intermediate

The bug that made a forum grind to 32 seconds a page — for $1,024

The drafts endpoint of a Discourse forum lacked the size validation applied to regular posts, so an authenticated user could save oversized drafts that the server still processed. Repeating this with several unique drafts caused response times to climb past 32 seconds for other users on the instance.

pawanjswal Follow

Published on pawanjswal.medium.com

Cybersecurity

Pawan Jaiswal, on pawanjswal.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. 5 min read.

Context

Discourse is forum software, and like most forum software it auto-saves what you are typing before you commit to posting it. That auto-save goes to /drafts.json. The draft is the same content as a post, just not published yet.

Regular posts are size-checked. If you try to submit an 800,000-character wall of text as an actual forum post, validation rejects it. Drafts did not get that check, so the same oversized payload that fails as a post was accepted as a draft. The server still has to process it, and processing something that large takes long enough that the gateway in front of the application gives up waiting and returns a 502 Bad Gateway. The backend then finishes the save anyway, after the gateway has already returned the error to the browser. The result is a broken response and a successful write at the same time.

HackerOne report #3400140: uncontrolled resource consumption in Discourse’s drafts endpoint. From the original on pawanjswal.medium.com

The finding was rated High severity (7.5). The report references a GitHub security advisory where a CVE is tracked, but gives no separate CVE number. The report references a public fix commit and a GitHub security advisory where the CVE is tracked; the HackerOne report itself does not give a separate CVE number.

Setup

The researcher worked against try.discourse.org, Discourse's own hosted demo instance, using a test account. No administrative access was needed: one authenticated account with no special privileges was enough to trigger the behaviour.

Requests were intercepted and modified with a proxy such as Burp Suite. The oversized payload used is linked in the report rather than reproduced in it.

Finding it

The starting observation is a validation gap between two endpoints that write the same underlying data. Posting content is checked for size; saving the same content as a draft is not. The researcher put it directly: "the payload cannot be posted as a message (due to validation), but drafts bypass this, allowing abuse."

That alone would be a curiosity if the oversized draft were simply stored. What made it interesting is that the server processes the payload on save, and the processing time is long enough to trip the gateway timeout. The 502 is therefore not a rejection: it is the front end giving up while the back end keeps working.

Exploitation

Step 1: Send an oversized draft

Log into the test account, intercept a draft request at POST /drafts.json with the proxy, and replace the draft content with the oversized payload.

HTTP
POST /drafts.json

The endpoint is the auto-save path for unpublished content. Because it does not apply the post size validation, the payload is accepted for processing.

Step 2: Get a 502, get a save

The response comes back broken with a 502 Bad Gateway, but the draft is saved underneath it. This step on its own demonstrates the validation gap and the mismatch between the error the client sees and the state the server reached.

How one oversized draft turns into a 502 that still saves, per #3400140 From the original on pawanjswal.medium.com

Step 3: Repeat with unique keys

Each new draft needs a distinct ID or key so it does not collide with an "already editing" conflict. The report describes using slight variations across nine drafts to dodge that lock.

Step 4: Fire them off

Send the nine drafts sequentially or in parallel; it does not matter much. Either way the backend has to chew through nine oversized payloads instead of one.

Step 5: Watch the clock

Response times for later requests climbed past 32 seconds.

Step 6: Cross-check from a second device

The program asked whether other users were affected. The researcher logged in from a completely separate device and connection and recorded both screens side by side. On that second account, normal actions such as loading a topic or writing a post took 32+ seconds or timed out entirely.

That last step is what turned the report from "my own requests are slow" into "the whole instance is slow for everyone on it".

From nine drafts to a stalled forum, as demonstrated in #3400140 From the original on pawanjswal.medium.com

Root cause

The mistake is a size limit enforced in one place and skipped in another. Posts and drafts write similar content, but only the post path validated length. The draft path at /drafts.json accepted the same oversized payload and passed it to the backend for processing.

The existing defences did not stop it for two reasons. First, the size validation simply was not applied to drafts. Second, the uniqueness constraint that produces the "already editing" conflict is not a rate limit: it stops collisions, not abuse, and it can be routed around by giving each draft a unique key. The gateway timeout is not a defence either, since it only affects the response the client sees, not whether the backend completes the write.

Impact

This is an availability bug, not a data leak, but the effect cascades:

  • One authenticated account, with no special privileges, is enough to trigger it.
  • The 502 actively hides that anything succeeded, so the abuse does not show up as an obvious error to the person doing it, or necessarily to anyone watching logs for failed saves.
  • The slowdown is not scoped to the attacker's session: a second account on a different device and connection saw the same 32-second delays.
  • The report notes this could scale further with scripting across multiple accounts or IPs, which would push a single-user annoyance toward genuine, forum-wide unresponsiveness.

Fix

The core remediation, per the disclosure, is applying to drafts the same size validation that already exists for posts. That closes the gap that let the payload through as a draft when it would have been rejected as a message. The report points to a public fix commit and a GitHub security advisory for the change.

Variants to test

  1. Every endpoint that writes the same underlying data. Compare the main write path with the secondary ones (drafts, autosave, previews, revisions). A positive result is a payload rejected by the main endpoint but accepted by the secondary one.
  2. State after any error response. After a 502, 504 or other gateway error, re-read the resource. A positive result is the write having completed despite the error.
  3. Uniqueness locks as pseudo rate limits. Try to bypass an "already editing" or similar conflict with unique keys. A positive result is many concurrent writes where the lock was assumed to cap them.
  4. Compounding requests. Send several oversized writes and time later requests. A positive result is response times climbing well beyond a single slow request.
  5. Second-account verification. Repeat the load from a separate account, device and connection. A positive result is the same delay or timeouts for a user who sent none of the payloads.

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. 11 min read.

What happened, in plain words

A forum is a website where people post messages and reply to each other. The software running this particular forum is called Discourse, and like most forum software it saves your work while you type, so you do not lose a long message if your browser crashes. That automatic save is called a draft.

The researcher found that the forum checked how big a message was allowed to be when you actually posted it, but not when it saved the same text as a draft. So he sent a draft of roughly 800,000 characters, about the length of a short novel. The server tried to handle it, took so long that the piece of software sitting in front of it gave up waiting and showed an error, while the backend finished saving the draft anyway.

He then made nine of these drafts. On a second account on a different device and connection, normal actions took 32+ seconds or timed out entirely. He proved this was not just his own connection by logging in from a second device on a different internet connection and recording both screens side by side.

The finding was rated High severity (7.5). The report references a GitHub security advisory where a CVE is tracked, but gives no separate CVE number. A CVE is a public catalogue number for a known security flaw, so other people can look it up and track when it is fixed. The report points to a public fix commit and a GitHub security advisory where the CVE is tracked; the HackerOne report itself does not give a separate CVE number.

HackerOne report #3400140: uncontrolled resource consumption in Discourse’s drafts endpoint. From the original on pawanjswal.medium.com

The pieces you need to know first

Before walking through the bug, here are the ideas it relies on, explained from scratch.

A server and a browser. Your browser is the program on your computer that shows web pages. The server is a computer somewhere else that stores the forum and sends pages to your browser when you ask for them. When you type a message, your browser sends the text to the server, and the server stores it.

An API endpoint. An endpoint is a specific address on the server that does one job. Think of a restaurant: the menu is the website, and each dish has a name you can order. /drafts.json is the name of the dish that means "save this text as a draft". The .json part just tells you the server replies in a common data format called JSON, which is a way of writing structured information as text.

A request and a response. When your browser asks the server to do something, that is a request. When the server answers, that is a response. A request has a method, which is a verb saying what you want: GET means "give me something", POST means "here is some data, store it".

A cookie or token. After you log in, the server gives your browser a small piece of text called a cookie or session token. Your browser sends it back with every request so the server knows who you are, like a wristband at an event that proves you paid to get in. Without it, the server treats you as a stranger.

A proxy. A proxy is a program that sits between your browser and the server and lets you look at, and change, the requests on their way through. Burp Suite is a well-known proxy used by security researchers. It is useful because the browser normally hides the details of requests from you, and a proxy lets you see and edit them.

A payload. The payload is the actual data you send in a request. In this case it is the oversized block of text.

A gateway. A gateway is a piece of software that sits in front of the application server and passes requests to it. Think of a receptionist who takes your form to the back office. If the back office takes too long, the receptionist eventually stops waiting and tells you "sorry, something went wrong". That message is the 502 Bad Gateway error. The important part is that the back office may still be working on your form after the receptionist has walked away.

Validation. Validation is the server checking that what you sent makes sense before it acts on it. A size check is a kind of validation: "this message is too long, reject it".

The vulnerability class. This bug is an availability problem, not a data leak. Nothing secret was exposed. Instead, the forum became so slow that ordinary people could not use it. Security people call this a denial of service, or DoS: making a service unavailable to the people who need it. When one logged-in user can do it, it is sometimes called a resource consumption bug, because the attacker makes the server consume more resources than it can spare.

A rate limit. A rate limit is a rule like "you may only do this ten times a minute". It exists to stop people hammering a service. The forum had an "already editing" lock, but that is not a rate limit, as we will see.

Setting the scene

The researcher worked against try.discourse.org, which is Discourse's own hosted demo instance, a public playground where anyone can try the software. He used a test account. No administrative access was needed: one ordinary logged-in account with no special privileges was enough to trigger the behaviour.

Requests were intercepted and modified with a proxy such as Burp Suite. The oversized payload used is linked in the report rather than reproduced in it, so the exact text is not shown here.

Finding it

The starting observation is a gap between two endpoints that write the same underlying data. Posting content is checked for size; saving the same content as a draft is not. The researcher put it directly: "the payload cannot be posted as a message (due to validation), but drafts bypass this, allowing abuse."

That alone would be a curiosity if the oversized draft were simply stored and forgotten. What made it interesting is that the server processes the payload when it saves it, and the processing time is long enough to trip the gateway timeout. The 502 is therefore not a rejection: it is the front end giving up while the back end keeps working.

Exploitation, step by step

Step 1: Send an oversized draft

Log into the test account, intercept a draft request at POST /drafts.json with the proxy, and replace the draft content with the oversized payload.

HTTP
POST /drafts.json

Line by line: POST is the method, the verb telling the server "I am sending you data to store". /drafts.json is the endpoint, the address of the auto-save feature. The proxy lets you swap that body for the oversized payload before the request leaves your machine.

This endpoint is the auto-save path for unpublished content. Because it does not apply the post size validation, the payload is accepted for processing.

Step 2: Get a 502, get a save

The response comes back broken with a 502 Bad Gateway, but the draft is saved underneath it. This step on its own demonstrates the validation gap and the mismatch between the error the client sees and the state the server reached.

How one oversized draft turns into a 502 that still saves, per #3400140 From the original on pawanjswal.medium.com

Why this matters: most people, seeing an error, assume nothing happened and move on. The backend finishes the save after the gateway has already returned the error to the browser. That is the difference between reading the error message and verifying what the server really did.

Step 3: Repeat with unique keys

Each new draft needs a distinct ID or key so it does not collide with an "already editing" conflict. The report describes using slight variations across nine drafts to dodge that lock.

An "already editing" lock is the forum's way of stopping two browser tabs from overwriting each other's draft. It is not a rate limit: it stops collisions, not abuse. By giving each draft a unique key, the researcher made the forum treat each one as a separate piece of work, so the lock never fired.

Step 4: Fire them off

Send the nine drafts sequentially or in parallel; it does not matter much. Either way the backend has to chew through nine oversized payloads instead of one.

Sequentially means one after another; in parallel means all at once. The server has to do the work either way.

Step 5: Watch the clock

Response times for later requests climbed past 32 seconds.

This is the measurement that turns a suspicion into evidence. Later requests climbing past 32 seconds shows the server is being loaded down by the drafts already sent.

Step 6: Cross-check from a second device

The program asked whether other users were affected. The researcher logged in from a completely separate device and connection and recorded both screens side by side. On that second account, normal actions such as loading a topic or writing a post took 32+ seconds or timed out entirely.

This is the step that turned the report from "my own requests are slow" into "the whole instance is slow for everyone on it". A bug that only slows down the person causing it is a curiosity; a bug that slows down other users is a real problem for the forum's owners.

From nine drafts to a stalled forum, as demonstrated in #3400140 From the original on pawanjswal.medium.com

Why it worked

The mistake is a size limit enforced in one place and skipped in another. Posts and drafts write similar content, but only the post path validated length. The draft path at /drafts.json accepted the same oversized payload and passed it to the backend for processing.

The existing defences did not stop it for two reasons. First, the size validation simply was not applied to drafts. Second, the uniqueness constraint that produces the "already editing" conflict is not a rate limit: it stops collisions, not abuse, and it can be routed around by giving each draft a unique key. The gateway timeout is not a defence either, since it only affects the response the client sees, not whether the backend completes the write.

What the impact was

This is an availability bug, not a data leak, but the effect cascades:

  • One authenticated account, with no special privileges, is enough to trigger it.
  • The 502 actively hides that anything succeeded, so the abuse does not show up as an obvious error to the person doing it, or necessarily to anyone watching logs for failed saves.
  • The slowdown is not scoped to the attacker's session: a second account on a different device and connection saw the same 32-second delays.
  • The report notes this could scale further with scripting across multiple accounts or IPs, which would push a single-user annoyance toward genuine, forum-wide unresponsiveness.

Scripting here means writing a small program to repeat the requests automatically, and IPs are the numeric addresses that identify computers on the internet.

The fix

The core remediation, per the disclosure, is applying to drafts the same size validation that already exists for posts. That closes the gap that let the payload through as a draft when it would have been rejected as a message. The report points to a public fix commit and a GitHub security advisory for the change.

What to take away if you are learning

  1. Check every endpoint that writes the same underlying data. Compare the main write path with the secondary ones (drafts, autosave, previews, revisions). A positive result is a payload rejected by the main endpoint but accepted by the secondary one.
  2. State after any error response. After a 502, 504 or other gateway error, re-read the resource. A positive result is the write having completed despite the error.
  3. Uniqueness locks as pseudo rate limits. Try to bypass an "already editing" or similar conflict with unique keys. A positive result is many concurrent writes where the lock was assumed to cap them.
  4. Compounding requests. Send several oversized writes and time later requests. A positive result is response times climbing well beyond a single slow request.
  5. Second-account verification. Repeat the load from a separate account, device and connection. A positive result is the same delay or timeouts for a user who sent none of the payloads.

Glossary

  • API: a set of addresses and rules a program uses to talk to a server, so software can ask for things without a human clicking.
  • Endpoint: one specific address in an API that does one job, such as /drafts.json for saving drafts.
  • Request: a message your browser sends to a server asking it to do something.
  • Response: the message the server sends back.
  • Method: the verb at the start of a request, such as GET (fetch) or POST (send data to store).
  • JSON: a plain-text format for structured data, easy for programs to read.
  • Cookie / session token: a small piece of text your browser stores after login and sends with each request so the server knows who you are.
  • Proxy: a program that sits between your browser and the server and lets you inspect and change requests, such as Burp Suite.
  • Payload: the actual data carried inside a request.
  • Gateway: software in front of the application server that forwards requests and can time out if the server is too slow.
  • 502 Bad Gateway: an error meaning the gateway gave up waiting for the server behind it.
  • Validation: a check the server performs on incoming data before acting on it, such as a maximum length.
  • Draft: content saved automatically before it is published as a post.
  • Rate limit: a rule capping how often someone can perform an action.
  • Denial of service (DoS): making a service unavailable or unusably slow for the people who need it.
  • Resource consumption: using up a server's processing power or memory so other work cannot get done.
  • Availability: whether a service is usable when people need it; an availability bug breaks that rather than leaking data.
  • CVE: a public catalogue number for a known security flaw.
  • Severity rating: a score, often from 0 to 10, saying how serious a flaw is; 7.5 is in the High band.
  • Fix commit: a recorded change to the software's code that repairs the flaw.
  • Security advisory: a public notice describing a flaw and its fix.
  • IP address: the numeric address that identifies a computer on the internet.
  • Scripting: writing a small program to repeat actions automatically.

More by pawanjswal

View all

3 more disclosed reports, best first.

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.