stop serving grtp.co over HTTP
The service grtp.co was accessible over plain HTTP on port 80, and the documentation used protocol-relative URLs that could load scripts over HTTP. An attacker could potentially intercept or redirect these requests to serve malicious JavaScript.
Originally disclosed on HackerOne
- Triaged in 25 days
- Fixed in 5 months
- Paid in 26 days
- Disclosed after 5 months
Target Domain: grtp.co
1 Issue Details: Service available on HTTP As per the policy details under scope on HackerOne portal(https://hackerone.com/gratipay), the 'grtp.co'. should be available only on port 443 or HTTPS protocol. However grtp.co service is running on port 80 too (i.e., running on HTTP protocol even). As we know this can leak lot of information about your target customers.
Side effects: URL1) https://github.com/gratipay/grtp.co/blob/master/README.md#examples
From the above URL1 page details: you are referring to URLs of grtp.co which targets to HTTP based URLs instead of HTTPS. Example code taken from URL 1 mentioned above:
<script data-gratipay-username="rummik" data-gratipay-widget="button" src="//grtp.co/v1.js" async></script>Solution: If we have HTTPS already, what ever the services we host on out web sites should points towards HTTPS URIs/URLs, but not to HTTP based URIs/URLs. This way we can achieve 100% encrypted communication & guaranty end user's safety. If not an attacker can learn that a about of user's activity happening on HTTP and can setup a fake DNS record to drive "grtp.co/v1.js" or "grtp.co/xxxx" kind of requests to malicious domain and can serve infected java script files making them fall as his/her pray.
2 Issue Details: Information Disclosure
Leaking lot of technical details during discussions with H1 researchers Example: https://hackerone.com/reports/116352
The above issue # 1 was identified while reading the report. That is why I am submitting both issues under one report.
Solution: Keep the details as crispy as possible while sharing with H1 researchers. Social Engineering is another possibility where a malicious researcher can make you leak more info.
Context
Gratipay ran a widget service on the domain grtp.co. The README documents an embed snippet that loads its JavaScript from that domain. The program's scope on HackerOne stated that grtp.co should be reachable only over port 443, that is, over HTTPS.
The report bundles two issues: the service answering on plain HTTP as well, and technical information being disclosed to researchers during HackerOne discussions. The author found the first while reading a previously disclosed report, which is why both are submitted together.
Setup
No accounts, roles, tools or versions are described. The researcher worked from the public scope page and from the public grtp.co repository on GitHub. The only precondition is network access to grtp.co on port 80 and to the repository's README.
Finding it
The scope said grtp.co should be HTTPS only. The researcher checked and found the service also running on port 80, serving over HTTP. The report does not show the request or response that demonstrated this; it states the observation directly.
The second thread came from the README of the grtp.co repository, which documents how to embed the widget. The examples there reference grtp.co URLs over HTTP rather than HTTPS, so a page served over HTTP would load the widget script unencrypted.
Exploitation
Step 1: Confirm the service answers on port 80
The researcher reports that grtp.co is running on port 80 in addition to 443. No request or response is included, so the exact headers and body returned over HTTP are not documented here.
Step 2: Read the widget documentation
The README's examples section is at:
https://github.com/gratipay/grtp.co/blob/master/README.md#examples
According to the report, the URLs referenced on that page point at HTTP-based URLs instead of HTTPS. The example embed code quoted from the README is:
<script data-gratipay-username="rummik"
data-gratipay-widget="button"
src="//grtp.co/v1.js" async></script>
The src uses a protocol-relative URL, //grtp.co/v1.js. On an HTTPS page the browser resolves it to HTTPS, but on an HTTP page it resolves to HTTP, so the script is fetched over plaintext. The data-gratipay-username and data-gratipay-widget attributes configure which user and which widget type the script renders.
Step 3: Reason about the consequence
The researcher argues that if HTTPS is already available, every service hosted on the sites should point at HTTPS URIs and URLs, not HTTP ones, to achieve fully encrypted communication and protect end users. Otherwise an attacker can learn about user activity happening over HTTP and can set up a fake DNS record to drive requests such as grtp.co/v1.js or grtp.co/xxxx to a malicious domain, serving infected JavaScript files to victims.
Step 4: Note the second issue
The report also flags information disclosure: too many technical details were being shared during discussions with HackerOne researchers. The example given is another report:
https://hackerone.com/reports/116352
The report does not describe what that discussion contained. The author's point is that the first issue was identified while reading a report, and that social engineering is another route by which a malicious researcher could extract more information.
Root cause
The design mistake is twofold. First, the service is exposed on port 80 even though the scope says it should be HTTPS only, so a plaintext path to the same content exists. Second, the published embed snippet uses a protocol-relative src, which inherits the page's scheme; on any HTTP page the widget script is loaded over HTTP. The report describes no defences against either problem.
Impact
The report frames the impact in terms of information leakage about the target's customers and of script substitution. The researcher argues an attacker can learn about user activity over HTTP and can set up a fake DNS record to send widget requests to a malicious domain and serve malicious JavaScript to users of pages that embed the widget over HTTP. The report hedges this: it says an attacker "can" do this, without demonstrating a working attack, and the severity assigned by the program was low with a bounty of 1.00 USD.
Fix
The report's recommendation is that everything hosted on the sites should point at HTTPS URIs and URLs rather than HTTP ones, so that communication is fully encrypted. In practice that means pointing the widget URLs at HTTPS rather than HTTP.
Variants to test
- Check whether a host that the scope says is HTTPS only also answers on port 80. A positive result is the service answering on port 80 at all.
- Grep a project's documentation and README for protocol-relative URLs such as
//example.com/script.jsin embed snippets. A positive result is a snippet that would load over HTTP when pasted into an HTTP page. - Look for mixed-content patterns in official integration guides, for example
http://insrc,hrefor formactionattributes. A positive result is a documented example that sends requests in plaintext. - Check whether the HTTP listener redirects to HTTPS or serves content directly.
Hunting notes
This kind of issue hides in two places: the edge configuration of a domain that the program claims is HTTPS only, and the project's own documentation, which often lags behind the deployment. During recon, the signal is a scope statement that names a scheme or port, followed by a quick check of the other port. For the documentation angle, reading the README and integration examples of the target's public repositories is cheap and often shows protocol-relative or http:// URLs that the maintainers never revisited.
The researcher tied the HTTP URLs in the official embed snippet to the risk of a fake DNS record redirecting grtp.co/v1.js requests to a malicious domain. and explaining how a fake DNS record could redirect grtp.co/v1.js requests to a malicious domain. That link between the exposed port and a real script load is what turns a bare port observation into a reportable finding. The second issue, disclosure during researcher discussions, is a process observation rather than a technical vulnerability and is presented without further evidence.
What happened, in plain words
Gratipay ran a small service on the domain grtp.co. That service provided a "widget": a small piece of code that other websites could paste into their pages so that a Gratipay button or similar element would appear there. The widget's code was loaded from grtp.co.
The rules of the bug bounty programme (the public list of what is in scope and what is allowed) said that grtp.co should only be reachable over port 443, which is the port used by HTTPS, the encrypted version of the web. The researcher found that the same service also answered on port 80, the port used by plain HTTP, which is not encrypted. He also found that the official instructions for embedding the widget pointed at addresses that could load over HTTP.
The report bundles a second, unrelated observation: too much technical detail was being shared with researchers during discussions on HackerOne, the bug bounty platform. The author says he found the first issue while reading a previously disclosed report, which is why he submitted both together.
Background you need
A few everyday ideas make the rest easy to follow.
- HTTP and HTTPS: HTTP is the way a browser asks a web server for a page and gets it back. HTTPS is the same conversation, but wrapped in encryption so that nobody between your computer and the server can read or change it. The unencrypted version uses port 80 by default; the encrypted version uses port 443. Think of HTTP as a postcard and HTTPS as a sealed letter.
- Port: a numbered door on a server. A single machine can run many services, each listening on a different door. Port 80 is the standard door for HTTP, port 443 for HTTPS.
- Domain: the name you type, such as
grtp.co. It is not the same thing as the server; a domain is translated into a server address by DNS, the internet's address book. - DNS: the system that turns a name like
grtp.cointo the numeric address of a machine. If an attacker can control the answer, they can send the name to a machine they own. - Widget: a small, self-contained piece of a website that you can embed in another page. Here it is a Gratipay button. The page includes a
<script>tag, and the browser fetches the widget's JavaScript fromgrtp.coand runs it. - JavaScript: the programming language that browsers run. A
<script>tag tells the browser to download a file of JavaScript and execute it. Whoever controls that file controls what runs in the visitor's browser. - Protocol-relative URL: an address that starts with
//instead ofhttp://orhttps://. The browser fills in the missing part from the page it is on. On an HTTPS page it becomes HTTPS; on an HTTP page it becomes HTTP. It is like saying "same road as the one I came in on". - Information disclosure: a weakness where something that should stay private, such as technical details about a system, becomes visible to someone who should not see it.
- Social engineering: persuading a person to reveal information or do something, rather than breaking in technically. A friendly conversation can be as effective as an exploit.
Setting up
The report does not describe any accounts, roles, tools or software versions. The researcher worked from two public things: the programme's scope page on HackerOne, and the public repository for grtp.co on GitHub. The only requirement was ordinary network access to grtp.co on port 80 and to the repository's README file. In other words, anyone with a browser could repeat what he did.
Finding it
The scope page said grtp.co should be HTTPS only. The researcher checked and found the service also running on port 80, answering over plain HTTP. The report does not include the request or response that showed this; it simply states the observation.
The second thread came from the README of the grtp.co repository, which explains how to embed the widget. The examples there refer to grtp.co addresses over HTTP rather than HTTPS. That means a website served over HTTP would load the widget's script over an unencrypted connection, because the instructions allowed it.
Exploitation
Step 1: Confirm the service answers on port 80
The researcher reports that grtp.co is running on port 80 as well as 443. No request or response is included, so the exact headers and body returned over HTTP are not documented. The point of this step is simple: the scope promised one door, and a second door was open. The report's concern is that plain HTTP can leak information about the target's customers.
Step 2: Read the widget documentation
The examples section of the README is at:
https://github.com/gratipay/grtp.co/blob/master/README.md#examples
This is a normal GitHub page. The #examples part at the end is an anchor: it tells the browser to jump down to the section headed "examples". The researcher read that section because it is where the project tells other site owners how to use the widget, and therefore where mistakes in the instructions would be copied by everyone.
According to the report, the addresses referenced on that page point at HTTP-based URLs instead of HTTPS. The example embed code quoted from the README is:
<script data-gratipay-username="rummik"
data-gratipay-widget="button"
src="//grtp.co/v1.js" async></script>
Line by line:
<scriptstarts a script tag, which tells the browser to download and run some JavaScript.data-gratipay-username="rummik"is a custom attribute. It does not do anything by itself; the widget script reads it to know which Gratipay user the button belongs to. Here the user isrummik.data-gratipay-widget="button"is another custom attribute, telling the script which kind of widget to draw. Here it is a button.src="//grtp.co/v1.js"is the address of the script to download. It starts with//, so it is protocol-relative: the browser uses the same scheme as the page it is on. On an HTTPS page this becomeshttps://grtp.co/v1.js; on an HTTP page it becomeshttp://grtp.co/v1.js, which is plaintext.asynctells the browser it can keep building the page while the script downloads, rather than waiting. It affects speed, not security.></script>closes the tag.
The important part is line 4. The instructions do not force HTTPS; they leave the choice to whatever page the snippet is pasted into. A site owner who follows the README on an HTTP page will load the widget over HTTP without realising it.
Step 3: Reason about the consequence
The researcher argues that if HTTPS is already available, everything the sites host should point at HTTPS addresses, not HTTP ones, so that communication is fully encrypted and end users are protected. Otherwise an attacker can learn about user activity happening over HTTP, and can set up a fake DNS record to send requests such as grtp.co/v1.js or grtp.co/xxxx to a malicious domain, serving infected JavaScript files to victims.
In plain terms: if the browser asks for the widget over HTTP, the answer can be tampered with. A fake DNS record is like changing the address in the phone book so that the name grtp.co resolves to the attacker's server. The browser then downloads v1.js from the attacker's server, which serves infected JavaScript files. The visitor sees a normal page with a malicious script inside it.
Step 4: Note the second issue
The report also flags information disclosure: too many technical details were being shared during discussions with HackerOne researchers. The example given is another report:
https://hackerone.com/reports/116352
This is a link to a different report on the same platform. The report does not describe what that discussion contained. The author's point is that he identified the first issue while reading a report, and that social engineering is another route by which a malicious researcher could extract more information. In other words, the way a team talks to researchers can itself leak details that help an attacker.
Root cause
The design mistake has two parts. First, the service is exposed on port 80 even though the scope says it should be HTTPS only, so a plaintext path to the same content exists. Second, the published embed snippet uses a protocol-relative src, which inherits the page's scheme; on any HTTP page the widget script is loaded over HTTP. The report describes no defences against either problem. HSTS is a header a server can send to tell browsers "always use HTTPS for this domain from now on".
Impact
The report frames the impact in terms of information leakage about the target's customers and of script substitution. The researcher argues an attacker can learn about user activity over HTTP and can set up a fake DNS record to send widget requests to a malicious domain and serve malicious JavaScript to users of pages that embed the widget over HTTP. The report hedges this: it says an attacker "can" do this, without demonstrating a working attack. The severity assigned by the programme was low, with a bounty of 1.00 USD.
Fix
The report's recommendation is that everything hosted on the sites should point at HTTPS addresses rather than HTTP ones, so that communication is fully encrypted. In practice that means pointing the widget URLs at HTTPS rather than HTTP.
Variants to test
These are the same checks, written so that a beginner can try them with a browser and a text editor.
- Check whether a host that the scope says is HTTPS only also answers on port 80. A positive result is the service answering on port 80 at all. In a browser, type the address with
http://in front and see whether a page comes back instead of an error. - Search a project's documentation and README for protocol-relative URLs such as
//example.com/script.jsin embed snippets. A positive result is a snippet that would load over HTTP when pasted into an HTTP page. Use your browser's find function on the README page. - Look for mixed-content patterns in official integration guides, for example
http://insrc,hrefor formactionattributes. A positive result is a documented example that sends requests in plaintext. - Check whether the HTTP listener redirects to HTTPS or serves content directly. A redirect is the server saying "go to the encrypted door"; serving content is the server saying "the unencrypted door is fine".
Hunting notes
This kind of issue hides in two places: the edge configuration of a domain that the programme claims is HTTPS only, and the project's own documentation, which often lags behind the deployment. During reconnaissance, the signal is a scope statement that names a scheme or port, followed by a quick check of the other port. For the documentation angle, reading the README and integration examples of the target's public repositories is cheap and often shows protocol-relative or http:// URLs that the maintainers never revisited.
The researcher tied the HTTP URLs in the official embed snippet to the risk of a fake DNS record redirecting grtp.co/v1.js requests to a malicious domain. and explaining how a fake DNS record could redirect grtp.co/v1.js requests to a malicious domain. That link between the exposed port and a real script load is what turns a bare port observation into a reportable finding. The second issue, disclosure during researcher discussions, is a process observation rather than a technical vulnerability and is presented without further evidence.
Glossary
- HTTP: the unencrypted protocol browsers use to request and receive web pages, by default on port 80.
- HTTPS: the encrypted version of HTTP, by default on port 443, so that nobody in between can read or change the traffic.
- Port: a numbered door on a server; different services listen on different ports.
- Domain: a human-readable name such as
grtp.cothat DNS translates into a server address. - DNS: the internet's address book, turning names into numeric addresses.
- Widget: a small self-contained piece of a website that can be embedded in another page.
- JavaScript: the programming language browsers run; a
<script>tag downloads and executes a file of it. - Script tag: the HTML element that tells the browser to fetch and run JavaScript.
- Protocol-relative URL: an address starting with
//that inherits HTTP or HTTPS from the page it appears on. - Attribute: an extra piece of information inside an HTML tag, such as
srcordata-gratipay-username. src: the attribute that gives the address of a file for the browser to load.async: an attribute telling the browser it can continue building the page while the script downloads.- README: the main documentation file of a software project, usually shown on its repository page.
- Repository: a project's storage space on a code hosting site such as GitHub, containing its files and history.
- Anchor: the
#sectionpart of a URL that makes the browser jump to a particular part of a page. - Information disclosure: a weakness where information that should stay private becomes visible to someone who should not see it.
- Social engineering: persuading a person to reveal information or take an action, instead of attacking a system technically.
- HSTS: a header a server can send to tell browsers to always use HTTPS for that domain.
- Mixed content: a page loaded over HTTPS that also pulls in resources over HTTP, weakening the encryption.
- Reconnaissance: the early, information-gathering phase of a security test.
- Scope: the list of systems and rules a bug bounty programme allows researchers to test.
- Bug bounty programme: a scheme where an organisation pays researchers for reporting security problems.
- HackerOne: the bug bounty platform where this report was submitted and discussed.
- Severity: a rating of how serious a finding is, here low.
- Bounty: the money paid for a valid report, here 1.00 USD.