Content Injection Affecting Crow package, versions [,0.3+4)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.08% (37th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Content Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-UNMANAGED-CROW-2336164
  • published12 Jan 2022
  • disclosed12 Jan 2022
  • creditSnyk Security Team

Introduced: 12 Jan 2022

CVE-2021-23824  (opens in a new tab)
CWE-79  (opens in a new tab)

How to fix?

Upgrade Crow to version 0.3+4 or higher.

Overview

Crow is a C++ microframework for running web services.

Affected versions of this package are vulnerable to Content Injection. When using attributes without quotes in the template, an attacker can manipulate the input to introduce additional attributes, potentially executing code. This may lead to a Cross-site Scripting (XSS) vulnerability, assuming an attacker can influence the value entered into the template. If the template is used to render user-generated content, this vulnerability may escalate to a persistent XSS vulnerability.

PoC

templates/test.html file:

<html><body><img src={{src}} /></body></html>

main.cpp file:

#include "crow.h"
int main()
{
    crow::SimpleApp app;
    CROW_ROUTE(app, "/")([](const crow::request& req){
        crow::mustache::context x;
        x["src"] = req.url_params.get("src");
        auto page = crow::mustache::load("test.html");
        return page.render(x);
    });
    app.port(8888).run();
}

The malicious payload: http://localhost:8888/?src=x%20onerror%3Dalert(1)

CVSS Scores

version 3.1