Skip to content
Open redirect Disclosed report Beginner

Is gitlab vulnerable to a host header attack?

GitLab redirects unauthenticated users to the sign-in page using the host from the X-Forwarded-Host header instead of the actual Host header. An attacker could craft a request with a spoofed X-Forwarded-Host to make GitLab issue a redirect to an attacker-controlled domain.

GitLab

Originally disclosed on GitLab

  • Fixed in 3.9 years
  • Disclosed after 3.9 years

https://github.com/gitlabhq/gitlabhq/issues/10143

GET /dashboard/ HTTP/1.1
Host: 1.2.3.4
X-Forwarded-Host: spoofed.com:443

will return

HTTP/1.1 302 Found
Server: nginx
Date: Thu, 17 Apr 2016 13:17:40 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 302 Found
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Location: http://spoofed.com:443/users/sign_in
Cache-Control: no-cache
Set-Cookie: _gitlab_session=xxxxxxxxxxxxxxxxxxxxxx; path=/; expires=xxxxxx; HttpOnly X-Request-Id: xxxxx
X-Runtime: 0.010452

Is this right? I'm using gitlab version 8.2.3-ce.0.

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

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 uses the X-Forwarded-Host header to build redirect URLs without validating it against the actual Host header.

What the attacker needed

Ability to send custom headers

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 you visit a web app, it sometimes sends you to another page (a redirect). The app should use the address you actually typed, but here it trusted a header called X-Forwarded-Host, which a client can set to anything. So an attacker could make the app send victims to a fake site that looks like the real one.

What is Open redirect?

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.