limit number of images in statement
The report notes that Gratipay statements allow an unlimited number of images to be embedded, which could cause visitors to unknowingly participate in a DDoS attack by loading many images from a target site. The author demonstrated this by placing 100 images on their own account.
- Triaged in 24 days
- Fixed in 16 months
- Paid in 26 days
- Disclosed after 16 months
Hello
The use of the images in the statements
{{media:0}}
There appears to be no limit on how many can be inserted. On my own account "https://gratipay.com/~34534534fsfs/" I placed 100
Gratipay users could unknowingly become part of a DDoS attack against another site.
I would recommend limiting the number of images that can be placed.
Attached is a video of just a traffic counter being triggered by the page load.
Attachments
What the report shows
The target is Gratipay, and the feature under examination is the statement, the free-text field on a user profile where a user can write about themselves. The researcher noticed that images can be embedded in a statement and that nothing appears to cap how many of them a single statement may contain.
To demonstrate it, the researcher used their own account at the following URL and placed 100 images in the statement:
https://gratipay.com/~34534534fsfs/
The report includes a screenshot of a statement containing embedded images:
The concern raised is that every visitor who loads such a profile page will fetch all of those images, so a Gratipay user could unknowingly become part of a DDoS attack against another site. The researcher recommends limiting the number of images that can be placed in a statement.
As supporting evidence, the report attaches a video of a traffic counter being triggered by the page load:
The report was rated medium severity under the weakness category Violation of Secure Design Principles, and a bounty of 1.00 USD was paid. It was disclosed on 2017-06-16. The report does not describe a fix.
Root cause
The report's concern is that the statement field appears to accept an unbounded number of embedded images, with no cap on how many a single statement may contain. There is no per-statement cap on image count, so a single stored statement can cause every viewer's browser to issue a large number of requests to a third-party host. The report frames this as a design problem rather than a parsing or injection flaw: the feature works as built, but the build has no limit.
Impact
The report's own framing is deliberately hedged: Gratipay users could unknowingly become part of a DDoS attack against another site. The mechanism is indirect. The attacker does not send traffic themselves; they store a statement full of image references pointing at a victim, and the traffic comes from the browsers of ordinary visitors who view the profile. The report does not quantify request volume, page weight or any effect on the victim, and it does not claim that Gratipay's own infrastructure was stressed. The report attaches a video of a traffic counter being triggered by the page load.
How this kind of bug works
Any feature that renders user-supplied remote resource references turns every viewer of that content into a client of whatever host the references point at. When the number of references per stored item is unbounded, the amplification factor is the number of references multiplied by the number of viewers. A popular profile, or a profile pushed to many viewers, multiplies the effect further.
The same primitive has a second use: because the requests originate from visitors' browsers, the victim sees traffic from many residential and corporate addresses rather than from a single server, which makes source-based filtering harder. The requests also carry whatever the browser normally sends, and the victim host sees the source address of each connection.
Defences are about bounding the amplification: cap the number of embedded resources per item, cap total rendered size, proxy or rewrite remote images through the platform's own infrastructure so the platform controls fetching, or strip remote references entirely and allow only uploaded media. Rate limiting the rendering endpoint helps with repeated views but does not address a single heavily viewed page.
How to test for it
- Identify fields that render user content to other users: profile bios, comments, signatures, issue descriptions, wiki pages, chat messages.
- Determine whether remote images are permitted. Submit a single reference to a host you control and confirm the request arrives when another user (or an unauthenticated session) views the content.
- If permitted, raise the count. Submit a statement containing many references to distinct paths on your host, then load the page in a fresh session and count the incoming requests. A positive result is a request count that scales with the number you submitted, with no server-side cap or truncation.
- Check whether the platform proxies or rewrites the references. If requests arrive from the platform's servers rather than the viewer's browser, the impact story changes and so does the severity.
- Test the same field through any API that accepts it, since client-side limits are often absent server-side.
Common false positives: the platform caches or proxies images so the victim sees one request per image rather than one per viewer; the field is truncated at render time; images are only shown to the author; or a content security policy blocks the loads in modern browsers while older clients still fetch them. Confirm the behaviour in a browser that actually issues the requests before reporting.
How it is fixed
- Enforce a maximum number of embedded resources per stored item, on the server, at write time.
- Enforce a maximum rendered size for user content.
- Proxy remote media through the platform so fetching is controlled and rate-limited centrally.
- Where remote media is not essential, allow only uploaded files and strip external references on render.
- Apply the same limits to every entry point that writes the field, including APIs and imports.
Hunting notes
This class tends to hide in older features that predate content security policy: profile fields, forum signatures, guestbooks, comment bodies and any markdown renderer configured to allow images. Recon signals include markdown or HTML rendering in a field, an image proxy endpoint, and a CSP that permits remote image sources. To make a report land, show the count scaling with what you submitted, show the requests arriving from a viewer's browser rather than your own, and keep the test on your own account and your own host. Programs are more likely to accept when you can show a concrete bound being exceeded rather than a theoretical multiplier.
What happened, in plain words
Gratipay is a website where people have a profile page. Each profile has a free-text area called a statement, where the person can write something about themselves. That text can include pictures: instead of typing words, you can point the page at an image that lives somewhere else on the internet, and the visitor's browser will go and fetch it and show it.
The researcher noticed that nothing seemed to stop a user from putting in as many of these pictures as they liked. To show it, they used their own account at this address and placed 100 images in the statement:
https://gratipay.com/~34534534fsfs/
Here is a screenshot of a statement with embedded images in it:
Why does that matter? Because of how a web page with a remote image works. When you open a page, your browser reads the page's instructions and, for every image on it, sends a separate request across the internet to whichever server holds that image. The server answers with the picture, and your browser draws it. You never see this happen; it is automatic.
So if one statement can hold 100 images, then every person who opens that profile causes requests to be sent to the site those images point at. The owner of the profile does not send any traffic themselves. The traffic comes from the browsers of ordinary visitors. The researcher's concern is exactly that: Gratipay users could unknowingly become part of a DDoS attack against another site. A DDoS attack is when so many requests arrive at a server at once that it cannot cope and stops responding to real users. Here the visitors are not attackers in any meaningful sense; they are just reading a profile.
As supporting evidence, the report attaches a video of a traffic counter being triggered by the page load:
A traffic counter is simply a page or tool that counts how many requests a server has received. The video shows a traffic counter being triggered by the page load.
The researcher's recommendation is short: limit the number of images that can be placed in a statement. The report was rated medium severity under the weakness category Violation of Secure Design Principles, and a bounty of 1.00 USD was paid. It was disclosed on 2017-06-16. The report does not describe a fix.
In general, this kind of bug
This is a design problem rather than a coding mistake in the usual sense. The feature works exactly as it was built: you can put images in your statement, and they show up. The problem is that the build has no ceiling. Security people call this a violation of secure design principles, meaning the overall plan of the feature is missing a safeguard, not that a line of code is broken.
The mechanism is worth spelling out because it appears in many products. Any feature that displays content written by one user to other users, and that lets that content point at files hosted elsewhere, turns every reader into a client of that elsewhere. The amplification is the number of references multiplied by the number of readers. A profile read by a few people is harmless. A profile read by thousands, or one pushed in front of many people, multiplies the effect.
There is a second angle. Because the requests come from visitors' browsers, the target sees traffic from many ordinary home and office internet connections rather than from one machine. Blocking a single source does not help, because there is no single source. The requests also carry whatever a browser normally sends, and the target can see the source address of each connection.
Defences are all about putting a bound on that amplification: cap how many embedded resources one item may contain, cap the total rendered size, fetch remote images through the platform's own servers so the platform controls and can rate-limit the fetching, or allow only uploaded files and strip external references when the page is rendered. Rate limiting the page itself helps with repeated views but does nothing about one heavily viewed page.
If you want to check for this yourself, the steps are:
- Find fields where one user's content is shown to others: profile bios, comments, signatures, issue descriptions, wiki pages, chat messages.
- See whether remote images are allowed. Put in a single reference to a host you control and confirm the request arrives when someone else, or a logged-out session, views the content.
- If it is allowed, raise the count. Submit a statement with many references to different paths on your host, load the page in a fresh session, and count the incoming requests. A positive result is a count that grows with what you submitted, with no cap or truncation on the server side.
- Check whether the platform fetches or rewrites the references. If the requests arrive from the platform's servers rather than the viewer's browser, the impact story changes, and so does the severity.
- Try the same field through any programming interface that accepts it, since limits applied in the browser are often missing on the server.
Watch out for false positives. The platform may cache or fetch images itself, so the target sees one request per image rather than one per viewer. The field may be cut short when rendered. Images may only be shown to the author. Or a content security policy, a set of rules a site gives the browser about which sources it may load from, may block the loads in modern browsers while older clients still fetch them. Confirm the behaviour in a browser that actually sends the requests before reporting.
Fixes follow the same logic: enforce a maximum number of embedded resources per stored item on the server when the content is saved; enforce a maximum rendered size; fetch remote media through the platform so fetching is controlled and rate-limited centrally; where remote media is not essential, allow only uploaded files and strip external references on render; and apply the same limits to every entry point that writes the field, including programming interfaces and imports.
This class of bug tends to hide in older features that predate content security policy: profile fields, forum signatures, guestbooks, comment bodies, and any text renderer set up to allow images. Signals to look for include text fields that render formatting or HTML, an image fetching endpoint, and a content security policy that permits remote image sources. To make a report land, show the count scaling with what you submitted, show the requests arriving from a viewer's browser rather than your own, and keep the test on your own account and your own host. Programs are more likely to accept when you can show a concrete bound being exceeded rather than a theoretical multiplier.
Glossary
- Statement: the free-text field on a Gratipay profile where a user writes about themselves.
- Request: a message a browser sends to a server asking for something, such as a page or an image.
- Server: a computer that stores a website and answers requests for it.
- Browser: the program you use to view web pages.
- Embedded image: a picture in a page that is stored on another site and fetched by the visitor's browser.
- DDoS attack: a flood of requests from many sources at once that overwhelms a server so it cannot serve real users.
- Traffic counter: a tool or page that counts how many requests a server has received.
- Severity: a rating of how serious a security issue is.
- Bounty: a payment made to a researcher who reports a valid security issue.
- Violation of Secure Design Principles: a weakness category for features whose overall design lacks a needed safeguard.
- Amplification: the way one stored item produces many requests, multiplied by the number of people who view it.
- Rate limiting: restricting how many requests are allowed in a period of time.
- Content security policy: rules a site gives the browser about which sources it may load content from.
- False positive: a finding that looks like a bug but is not, or does not have the impact claimed.