Skip to content
Threat Feed
high advisory

AWS SDK for PHP CloudFront Policy Document Injection via Special Characters

A vulnerability exists in the AWS SDK for PHP CloudFront signing utilities where special characters in input values are not properly handled when creating policy documents, potentially leading to unintended access restrictions, affecting versions 3.11.7 through 3.371.3.

A vulnerability exists in the CloudFront signing utilities within the AWS SDK for PHP, specifically impacting versions 3.11.7 through 3.371.3. These utilities are responsible for generating Amazon CloudFront signed URLs and signed cookies, which control access to content. The vulnerability arises from the improper handling of special characters, such as double quotes and backslashes, within input values used to construct policy documents. If an application passes unsanitized input containing these characters to the signing utilities, the resulting policy document may deviate from the application’s intended access restrictions. An enhancement was made to the AWS SDK for PHP version 3.371.4 to address this issue. This vulnerability impacts applications that do not properly sanitize inputs passed to the CloudFront signing utilities.

Attack Chain

  1. An attacker identifies an application using a vulnerable version of the AWS SDK for PHP (3.11.7 - 3.371.3) that utilizes CloudFront signed URLs or cookies.
  2. The attacker locates an input field within the application that is used to generate CloudFront policy documents.
  3. The attacker crafts a malicious input string containing special characters (e.g., double quotes, backslashes) designed to manipulate the resulting policy document.
  4. The application passes the attacker-controlled input to the CloudFront signing utilities without proper sanitization or validation.
  5. The CloudFront signing utilities generate a signed URL or cookie with a flawed policy document due to the injected special characters.
  6. The attacker uses the crafted signed URL or cookie to bypass intended access restrictions and potentially gain unauthorized access to protected content.
  7. The attacker accesses restricted resources on CloudFront that should have been protected by the intended policy.

Impact

Successful exploitation of this vulnerability could lead to unauthorized access to content protected by Amazon CloudFront. If an attacker can manipulate the policy document, they might bypass intended access restrictions, potentially exposing sensitive data or allowing unauthorized actions. The number of affected applications is unknown, but any application using the vulnerable versions of the AWS SDK for PHP and failing to sanitize input is at risk.

Recommendation

  • Upgrade to AWS SDK for PHP version 3.371.4 or later to incorporate the fix that addresses special character handling (reference: Patches section).
  • Implement robust input validation in application code to sanitize or escape special characters before passing values to CloudFront signing utilities (reference: Workarounds section).
  • Monitor web server logs for unusual patterns of URL requests containing special characters that might indicate exploitation attempts (reference: webserver log source).

Detection coverage 2

Detect Suspicious CloudFront URL Parameters with Special Characters

medium

Detects potentially malicious CloudFront URL parameters containing special characters that could indicate policy injection attempts.

sigma tactics: initial_access techniques: T1190 sources: webserver, linux

Detect Suspicious POST requests to CloudFront URL

medium

Detects potentially malicious POST requests containing special characters in the request body that could indicate policy injection attempts.

sigma tactics: initial_access techniques: T1190 sources: webserver, linux

Detection queries are kept inside the platform. Get full rules →

Indicators of compromise

1

email

TypeValue
emailaws-security@amazon.com