DoS via large console messages
A server that logs console messages at debug level can be made unresponsive by sending a slash command with a value over about 64KB, because the error log includes the oversized command. An attacker can repeatedly crash the server, denying service to all users.
Originally disclosed on HackerOne
- Triaged in 3 days
- Fixed in 10 months
- Paid in 14 days
- Disclosed after 10 months
Summary:
When server console logging is enabled, it's possible to cause a complete denial of service to the server by submitting large text (>64KB) that gets output in the console log. This causes the server to become unavailable for all users.
Steps To Reproduce:
I set up my environment following the steps at https://developers.mattermost.com/contribute/server/developer-setup/windows-wsl/
- Create a test server and team.
- Make sure console logging is enabled in the server settings, with debug level.
- Visit the server via Burp Suite for the next step.
- Go to a channel, and type some non-existing slash command like
/commandthat doesn't exist, and execute it while intercepting the request in Burp Suite. - You should get a POST request to
/api/v4/commands/executewith a JSON body with acommandvalue. - Send the request to the Repeater in Burp Suite.
- The vulnerability comes from the fact that if you type a non-existent command, it will log an error that includes the command you gave. There is no size limit on the command value in the API directly (only in the text box).
- Replace the command value with
/000000000000000000000000000000000000000000000000000000000000000..., where you use more than ~64KB of text (66,000+ characters will do nicely). You can copy and paste, select all, and copy-paste repeatedly to generate a large text size. - If you send the request with this super large payload, the server will see the command is invalid, and try to log the error message to the console. The error message contains the large payload, and will cause the server to become unresponsive if the log message is over ~64KB (65,535 bytes) (The size includes the rest of the error message, so the exact payload size required will be a bit less, but 66,000 bytes ensures it will always work without adding too many unnecessary characters).
- The server will not connect now until you restart with the
make run-servercommand, and will be unavailable for all users and all teams.
This only works when CONSOLE logging is enabled (file logging doesn't seem to be affected). And for this attack vector, it is required to have DEBUG logging enabled, but it might be possible to find a vector that works via a different log type.
I will say I also found another vector abusing this same issue via SQL query logging, which I will submit later depending on the status of this report. But obviously, since it requires SQL query logging to be enabled it's not as big of an issue as this one, and it has the same root cause.
Impact
Complete Denial of Service to all users of a server. It would be trivial to execute a script that automatically sends the payload whenever the server is available, to make sure it continually crashes.
Context
Mattermost is a self-hosted team messaging server. Its server component exposes a REST API under /api/v4/, and one of the endpoints, /api/v4/commands/execute, runs slash commands typed into a channel. When a user submits a command that does not exist, the server treats it as an error and writes a log line that includes the command text the user supplied.
The report concerns what happens when that log line is very large and console logging is enabled. The researcher found that a single API request carrying more than roughly 64KB of command text makes the server unresponsive for every user on every team, until it is restarted.
Setup
The environment was built following the Mattermost developer setup guide for Windows WSL, at https://developers.mattermost.com/contribute/server/developer-setup/windows-wsl/. Two server settings matter for the attack:
- Console logging must be enabled.
- The log level must be DEBUG.
The researcher notes that file logging did not appear to be affected, and that DEBUG level was required for this particular vector. They also mention a second vector using SQL query logging, with the same root cause, which they planned to submit separately depending on the outcome of this report; that one requires SQL query logging to be enabled and is therefore less severe.
Burp Suite was used to intercept and replay the request.
Finding it
The starting observation is simple: a non-existent slash command produces an error log entry that contains the command string the client sent. The web text box limits how much you can type, but the API itself imposes no size limit on the command value. That gap between the UI limit and the API limit is what makes the log line attacker-controlled in length.
Exploitation
Step 1: Create a test server and team
A fresh server and team give a clean target for the test.
Step 2: Enable console logging at DEBUG level
In the server settings, console logging is turned on and the level set to debug. Without this, the error is not written to the console in the way that triggers the problem.
Step 3: Route traffic through Burp Suite
The server is visited through Burp Suite so the next request can be intercepted.
Step 4: Trigger a non-existent slash command
In a channel, type a slash command that does not exist, such as /command, and execute it while Burp Suite is intercepting.
Step 5: Capture the request
The intercepted request is a POST to /api/v4/commands/execute with a JSON body containing a command value.
Step 6: Send it to Repeater
The request is forwarded to Burp Repeater so the body can be edited and resent repeatedly.
Step 7: Understand why the payload works
Because the command does not exist, the server logs an error that includes the command as supplied. The API does not enforce a size limit on the command value; only the text box in the UI does.
Step 8: Build the oversized command
Replace the command value with a long run of characters:
/000000000000000000000000000000000000000000000000000000000000000...
The payload needs more than about 64KB of text; 66,000 or more characters is enough. The researcher generated it by copy-paste, selecting all and pasting repeatedly to grow the string.
Step 9: Send the request
The server sees that the command is invalid and tries to write the error message to the console. That message contains the large payload. If the log message exceeds roughly 64KB (65,535 bytes), the server becomes unresponsive. The size counts the rest of the error message too, so the exact payload needed is slightly less than the threshold; 66,000 bytes guarantees it works without adding many unnecessary characters.
Step 10: Observe the outage
The server no longer accepts connections until it is restarted with:
make run-server
While it is down, it is unavailable to all users and all teams.
Root cause
The error path logs the user-supplied command string without bounding its length, and the API does not enforce the size limit that the UI applies. When console logging is enabled at DEBUG level, a log message above roughly 64KB appears to break the logging path badly enough that the server stops serving requests. The report does not identify the specific code that fails at that size, so the precise mechanism inside the logger is not stated.
The existing defence, the text box limit, is client-side only and is bypassed by talking to the API directly. File logging did not show the same behaviour in the researcher's testing, so the failure is tied to the console output path.
Impact
A complete denial of service against all users of the server. The researcher notes it would be trivial to run a script that resends the payload whenever the server comes back, keeping it continually down. The attack requires console logging to be enabled and, for this vector, DEBUG level; the researcher suggests other log types might offer a working vector but does not demonstrate one here.
Fix
The report does not describe a fix or a code change.
Variants to test
- Other endpoints that echo user input into error logs. Send an oversized value and watch for the server becoming unresponsive while console logging is on.
- Other log sinks. The researcher found SQL query logging reachable through the same root cause; try any logging mode that records request-derived strings.
- Different log levels. This vector needed DEBUG; check whether other levels still log the offending value in a way that reproduces the outage.
- Fields other than
commandin the same request body, and other API parameters that end up in error messages.
A positive result is the server failing to respond to any request after the oversized value is logged, recovering only after a restart.
Hunting notes
This kind of bug hides where user input is concatenated into log messages: error paths for invalid input, validation failures, and anything that echoes a request field back. During recon, look for applications that expose a REST API alongside a UI with input length limits, since the API often lacks the same checks. Console logging at debug level is a strong signal, because verbose error output is exactly where unbounded strings land. The researcher showed impact by demonstrating that the whole server, not just one request, became unavailable to all users and all teams, and that a restart was needed to recover.
What happened, in plain words
Mattermost is a chat program that a company or group can run on its own computer (a server) instead of using someone else's cloud service. People open it in a browser, join a team, and type messages in channels, much like any other chat app. It also has a feature called slash commands: you type something starting with a forward slash, like /help, and the server does a special action instead of posting a normal message.
Behind the browser page sits an API. An API is the set of doors a program offers so other programs can talk to it. When you use the Mattermost web page, the page itself is quietly sending requests to those doors on your behalf. One door, called /api/v4/commands/execute, is the one that runs slash commands.
The researcher found that if you send a slash command that does not exist, the server writes a note into its log saying "this command was invalid" and copies the command text into that note. A log is a running diary the server keeps of what happened, useful for fixing problems. The web page's text box stops you typing a very long command, but the API door does not check the length. So you can send a command of any size straight to the door, skipping the text box.
When that command is huge, over roughly 64KB, and console logging is enabled at DEBUG level, the log note becomes huge too, and the server stops responding to anyone at all. It stays stuck until someone restarts it. That is a denial of service: not stealing data, just making the service unusable.
Context
Mattermost is self-hosted, meaning the organisation runs the server itself. Its server component offers a REST API under /api/v4/. REST is just a common style for web APIs: each URL is a door, and you knock with standard web requests such as GET (fetch something) or POST (send something). The endpoint /api/v4/commands/execute is the door that runs slash commands typed into a channel.
When a user submits a command that does not exist, the server treats it as an error and writes a log line that includes the command text the user supplied. A log line is one entry in the server's diary.
The report concerns what happens when that log line is very large and console logging is enabled. Console logging means the diary entries are printed to the console, the text window where the server program runs and shows its output. The researcher found that a single API request carrying more than roughly 64KB of command text makes the server unresponsive for every user on every team, until it is restarted.
Setup
The environment was built following the Mattermost developer setup guide for Windows WSL, at https://developers.mattermost.com/contribute/server/developer-setup/windows-wsl/. WSL is a way to run a Linux environment inside Windows, which is handy because many server programs are built for Linux.
Two server settings matter for the attack:
- Console logging must be enabled.
- The log level must be DEBUG.
A log level is a filter for how chatty the diary is. DEBUG is the most detailed level: it records lots of extra information that normal operation would skip. The researcher notes that file logging did not appear to be affected, and that DEBUG level was required for this particular vector. A vector here means a route to the same weakness. They also mention a second vector using SQL query logging, with the same root cause, which they planned to submit separately depending on the outcome of this report; that one requires SQL query logging to be enabled and is therefore less severe. SQL is the language used to talk to a database, and SQL query logging records every database question the server asks.
Burp Suite was used to intercept and replay the request. Burp Suite is a tool that sits between your browser and a website, letting you pause a request, look at it, change it, and send it again. Think of it as a post office worker who can open your letter, rewrite it, and post it for you.
Finding it
The starting observation is simple: a non-existent slash command produces an error log entry that contains the command string the client sent. The web text box limits how much you can type, but the API itself imposes no size limit on the command value. That gap between the UI limit and the API limit is what makes the log line attacker-controlled in length. UI means user interface, the part you see and click; the API is the door underneath it, and the two do not always enforce the same rules.
Exploitation
Step 1: Create a test server and team
A fresh server and team give a clean target for the test. Starting clean means nothing else is going on that could confuse the result.
Step 2: Enable console logging at DEBUG level
In the server settings, console logging is turned on and the level set to debug. Without this, the error is not written to the console in the way that triggers the problem. This step is preparation: the bug only shows itself when the server is printing detailed diary entries to its console window.
Step 3: Route traffic through Burp Suite
The server is visited through Burp Suite so the next request can be intercepted. Intercepting means catching the request mid-flight before it reaches the server, so you can inspect and alter it.
Step 4: Trigger a non-existent slash command
In a channel, type a slash command that does not exist, such as /command, and execute it while Burp Suite is intercepting. The point is to produce a request that the server will treat as an error, because the error path is where the command text gets copied into the log.
Step 5: Capture the request
The intercepted request is a POST to /api/v4/commands/execute with a JSON body containing a command value. JSON is a simple text format for structured data, using curly braces and quoted names, like a labelled form. The body is the part of the request that carries the data, here the command itself.
Step 6: Send it to Repeater
Repeater is a Burp Suite feature that lets you resend the same request over and over with edits. The request is forwarded there so the body can be edited and resent repeatedly.
Step 7: Understand why the payload works
Because the command does not exist, the server logs an error that includes the command as supplied. The API does not enforce a size limit on the command value; only the text box in the UI does. A payload is the malicious content you send; here it is simply a very long command string.
Step 8: Build the oversized command
Replace the command value with a long run of characters:
/000000000000000000000000000000000000000000000000000000000000000...
Line by line: the leading / makes the server treat the text as a slash command. The long run of zeros is filler to make the string enormous. The ... at the end stands for "and so on", meaning you keep adding characters.
The payload needs more than about 64KB of text; 66,000 or more characters is enough. KB means kilobytes, a unit of data size; 64KB is roughly 65,535 bytes, and one byte is roughly one character of plain text. The researcher generated it by copy-paste, selecting all and pasting repeatedly to grow the string. That is a practical trick: paste, select everything, copy, paste again, and the text doubles each time.
Step 9: Send the request
The server sees that the command is invalid and tries to write the error message to the console. That message contains the large payload. If the log message exceeds roughly 64KB (65,535 bytes), the server becomes unresponsive. The size counts the rest of the error message too, so the exact payload needed is slightly less than the threshold; 66,000 bytes guarantees it works without adding many unnecessary characters.
Step 10: Observe the outage
The server no longer accepts connections until it is restarted with:
make run-server
Line by line: make is a tool that runs predefined tasks described in a project file. run-server is the name of the task that starts the Mattermost server. So the whole line means "run the task that starts the server". While it is down, it is unavailable to all users and all teams.
Root cause
The error path logs the user-supplied command string without bounding its length, and the API does not enforce the size limit that the UI applies. When console logging is enabled at DEBUG level, a log message above roughly 64KB appears to break the logging path badly enough that the server stops serving requests. The report does not identify the specific code that fails at that size, so the precise mechanism inside the logger is not stated.
The existing defence, the text box limit, is client-side only. Client-side means the check happens in your browser, on your machine, so anyone who talks to the API directly skips it entirely. File logging did not show the same behaviour in the researcher's testing, so the failure is tied to the console output path.
Impact
A complete denial of service against all users of the server. The researcher notes it would be trivial to run a script that resends the payload whenever the server comes back, keeping it continually down. A script here is a small program that repeats an action automatically. The attack requires console logging to be enabled and, for this vector, DEBUG level; the researcher suggests other log types might offer a working vector but does not demonstrate one here.
Fix
The report does not describe a fix or a code change.
Variants to test
- Other endpoints that echo user input into error logs. Send an oversized value and watch for the server becoming unresponsive while console logging is on.
- Other log sinks. A log sink is a destination where log entries go, such as the console or a file. The researcher found SQL query logging reachable through the same root cause; try any logging mode that records request-derived strings.
- Different log levels. This vector needed DEBUG; check whether other levels still log the offending value in a way that reproduces the outage.
- Fields other than
commandin the same request body, and other API parameters that end up in error messages.
A positive result is the server failing to respond to any request after the oversized value is logged, recovering only after a restart.
Hunting notes
This kind of bug hides where user input is concatenated into log messages. Concatenated means glued together: the program takes your text and sticks it onto the end of a fixed message. Error paths for invalid input, validation failures, and anything that echoes a request field back are the places to look. During recon, meaning the early exploration of a target, look for applications that expose a REST API alongside a UI with input length limits, since the API often lacks the same checks. Console logging at debug level is a strong signal, because verbose error output is exactly where unbounded strings land. The researcher showed impact by demonstrating that the whole server, not just one request, became unavailable to all users and all teams, and that a restart was needed to recover.
Glossary
- API: the set of doors a program offers so other programs can talk to it, usually over the web.
- REST: a common style for web APIs where each URL is a door and standard web requests are used to knock.
- Endpoint: one specific URL in an API, such as
/api/v4/commands/execute. - POST: a type of web request used to send data to a server.
- GET: a type of web request used to fetch something from a server.
- JSON: a simple text format for structured data, using curly braces and quoted names.
- Request body: the part of a request that carries the data being sent.
- Slash command: a chat command starting with
/that makes the server perform an action. - Log: a running diary the server keeps of what happened.
- Log line: one entry in that diary.
- Log level: a filter for how detailed the diary is; DEBUG is the most detailed.
- Console logging: printing log entries to the console window where the server runs.
- File logging: writing log entries into a file instead of the console.
- SQL: the language used to talk to a database.
- SQL query logging: recording every database question the server asks.
- Log sink: a destination where log entries go, such as the console or a file.
- Vector: a route or method used to reach a weakness.
- Root cause: the underlying reason a flaw exists.
- Payload: the malicious content you send to trigger a flaw.
- Denial of service (DoS): making a service unusable for its normal users.
- Unresponsive: not answering requests at all.
- Client-side: a check or action that happens in your browser, on your machine.
- UI (user interface): the part of a program you see and click.
- Burp Suite: a tool that sits between your browser and a website so you can pause, inspect, change and resend requests.
- Intercept: catching a request mid-flight before it reaches the server.
- Repeater: a Burp Suite feature for editing and resending the same request repeatedly.
- WSL: a way to run a Linux environment inside Windows.
- KB (kilobyte): a unit of data size; 64KB is roughly 65,535 bytes.
- Byte: a unit of data, roughly one character of plain text.
- Concatenate: glue text together, here sticking user input onto a fixed log message.
- Recon: the early exploration of a target to learn how it works.
- CVSS: a standard scoring system for how serious a security flaw is.
- Bounty: a payment a company gives a researcher for reporting a valid flaw.
- Severity: how serious a flaw is judged to be.
make: a tool that runs predefined tasks described in a project file.make run-server: the task that starts the Mattermost server.