Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws: Fix improper url substring validation #9174

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

arthurscchan
Copy link
Contributor

@arthurscchan arthurscchan commented Nov 23, 2023

Cloud Custodians base notifier is susceptible to an improper URL string validation which may allow an attacker to trick Cloud Custodian into leaking data by sending messages to URLs under the attackers control. The issue allows an attacker who can add items to the transport queue to control the URL that the base notifier sends payloads to. Besides the potential for leaking data, an attacker could also manipulate subsequent workflow by crafting a malicious response to Cloud Custodian.

The issue requires high privileges to exploit: Permissions to deploy policies are necessary.

The issue lies in the two first branches of send_sqs. Assuming that an attacker can control the queue variable defined on line 384, they can get past the first conditional check on line 385-387 if queue does not start with the string https://queue.amazonaws.com. The second conditional checks whether queue.amazonaws.com is a substring of queue. An attacker can bypass that in a number of ways, either by crafting a subdomain of their own domain, for example queue.amazonaws.com.malicious-url.cc, or by including a URL parameter, for example: malicious-url.cc?queue.amazonaws.com. The conditional check on line 388 will return true and queue_url will be assigned the attackers URL. send_sqs will proceed to line 407, and the client will sent the message to the attacker-controlled URL on line 416.

This PR fixes that by changing the conditional check for the URL validation.

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
@arthurscchan arthurscchan marked this pull request as ready for review November 23, 2023 17:41
@arthurscchan arthurscchan changed the title Fix improper url substring validation aws: Fix improper url substring validation Nov 23, 2023
@kapilt
Copy link
Collaborator

kapilt commented Nov 29, 2023

policies are considered trusted inputs, so this is targeting something that's not a valid threat model. ie. its a trivial policy to destroy all vms instances if your assuming malicious policy authoring intent.

@AdamKorcz
Copy link
Contributor

@kapilt Would you prefer to not merge this, or to merge as a cosmetic edit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants