Skip to content
Misconfiguration Disclosed report Intermediate

Corrupted Authorization header can cause logs not to be ingested properly in ████████

A crafted Authorization header containing a space can inject an extra delimiter into nginx access logs, causing the log ingestion system to discard the entire log entry. An attacker could use this to hide their requests from the logs used for incident response and debugging.

jobert Follow

Originally disclosed on HackerOne

Medium 6.1 View original
  • Triaged in under an hour
  • Fixed in 4 months
  • Disclosed after 4 months

HackerOne ingests different logs in ██████, one of them being nginx access logs from our load balancers. The default log format of our load balancer configuration is shown below. As can be seen in the format, the HTTP user specified in the Authorization header ($remote_user) is placed between the $remote_addr and [$time_local]. A log entry is delimited with white space and the $remote_user variable isn't surrounded with quotes. When a user isn't specified, its value is set to -.

During a white box test of another component in a network, it was identified that an additional delimiter can be injected, which seems to cause ingestion of the log entry to fail and the log entry to be discarded.

H1 nginx log format

log_format cf_custom '$remote_addr - $remote_user [$time_local] '
                     '"$request" $status $body_bytes_sent '
                     '"$http_referer" "$http_user_agent" "$host" '
                     '$request_time $upstream_response_time $pipe '
                     '$http_cf_ray $cookie___cfduid '
                     '"$http_x_forwarded_proto" "$http_x_forwarded_for" '
                     '"$http_x_amzn_trace_id"';

Consider the following cURL command:

curl -X POST -u '- A:B' https://hackerone.com/graphql\?secret\=1

This will result in the following request being submitted:

HTTP request

POST /graphql?secret=1 HTTP/2
Host: hackerone.com
Authorization: Basic LSBBOkI=
User-Agent: curl/7.54.0
Accept: */*

When this request is processed by nginx, the $remote_user (- A) is being added to the log entry. However, since the delimiter (the whitespace) isn't escaped and no quotes are surrounding the value, an additional column is added to the log entry. When this is ingested by █████████, the log for that particular request doesn't seem to appear in the Events source. However, as the request itself is valid, it'll be proxied to the upstream.

Because our Rails logs have a different format (JSON), we do have the ability to still determine which requests were sent to our backend. There are very few requests who are stopped on our load balancer and none of them have the ability to interact directly with out database. This lowers the impact of the vulnerability. However, in order for us to rely on either access log that is being ingested, we should address this issue.

It is currently unknown where the root cause of this vulnerability lies. nginx, by default, uses a very similar log item format: http://nginx.org/en/docs/http/ngx_http_log_module.html. Similar to the HackerOne configuration, the $remote_user is not enclosed in double quotes. The fact that nginx doesn't encode the whitespace may actually be something they want to fix going forward. However, it seems rather odd that █████████ completely discards a log entry. Let's figure out where the vulnerability comes from and what we can do to fix it.

The $cookie___cfduid parameter may also be vulnerable to the same attack.

Impact

This may impact our ability to give a conclusive answer during incident response or debugging based on the nginx load balancer access logs.

The original report as published on HackerOne, by jobert. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 nginx log format does not quote or escape the $remote_user variable, so a space in the username adds an extra delimiter and breaks the log parser.

Impact

The attacker's requests may be missing from the nginx access logs, which could hinder incident response and debugging, though Rails logs still record the requests and few requests are stopped at the load balancer.

What the attacker needed

Ability to send requests with a custom Authorization header

How it was found

  1. Send a request with an Authorization header whose username contains a space and a colon.
  2. Observe that nginx writes the username into the access log without quoting, adding an extra column.
  3. Check that the log ingestion system discards the malformed log entry.

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.

When a web server logs each request, it writes fields like the client's address and username separated by spaces. If an attacker can put a space inside the username, the log line gets an extra field and the log-reading system may reject the whole line. That means the attacker's request is not recorded in the logs that defenders rely on.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by jobert

View all

67 more disclosed reports, best first.

More from HackerOne

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.