When a seemingly innocuous open‑source tool is weaponised, the ripples can reach the heart of cloud infrastructure. Recent findings by security firm Wiz have exposed a chain of attacks that leveraged a Server‑Side Request Forgery (SSRF) flaw in Pandoc, a popular document converter, to breach Amazon Web Services’ Instance Metadata Service (IMDS). The result? Stolen IAM credentials that grant attackers broad access to EC2 instances and beyond.
Why Pandoc Matters
Pandoc is more than a niche utility; it’s a cornerstone of documentation pipelines for developers, researchers, and publishers worldwide. Its ability to convert between over 30 markup formats has made it a go‑to tool in CI/CD workflows, automated build scripts, and even serverless functions. The software’s widespread adoption means a vulnerability can affect a surprisingly large attack surface.
Understanding CVE‑2025‑51591
Classified as CVE‑2025‑51591, this SSRF vulnerability carries a CVSS score of 6.5, signalling a moderate to high severity. In a nutshell, the flaw allows an unauthenticated attacker to instruct Pandoc to fetch arbitrary URLs. When executed in a privileged environment, such as an EC2 instance, the attacker can coerce Pandoc into requesting internal network addresses, notably the IMDS endpoint at http://169.254.169.254.
IMDS hosts critical metadata about the instance, including IAM role tokens. Once an attacker retrieves these tokens, they effectively gain the same permissions as the instance’s assigned IAM role. This can lead to lateral movement, data exfiltration, or persistence across the entire AWS account.
How the Attack Unfolds
- Step 1: Malicious Payload Injection – An attacker crafts a Pandoc command that fetches a file from a malicious URL.
- Step 2: SSRF Trigger – Pandoc processes the command and initiates an HTTP request to the supplied address.
- Step 3: IMDS Targeting – The request is directed to
169.254.169.254/metadata/iam/security-credentials/ROLE_NAME, where the instance’s IAM credentials are returned. - Step 4: Credential Theft – The attacker captures the JSON payload containing temporary access keys and secrets.
- Step 5: Escalation – With these credentials, the attacker can perform API calls on behalf of the instance, potentially compromising entire workloads.
Why AWS IMDS Is a Goldmine
Amazon’s IMDS is designed to provide metadata to applications running on EC2 instances. While the service is tightly controlled, its default behaviour allows any process on the instance to read the metadata. This openness is intentional for convenience but creates a target when combined with SSRF.
When an attacker obtains IAM tokens from IMDS, they essentially inherit the permissions granted to the instance role. If that role has broad privileges—such as access to S3 buckets, RDS databases, or other critical resources—the breach can cascade quickly, turning a single compromised instance into a launchpad for a full‑blown account takeover.
Real‑World Impact
Wiz’s investigation uncovered dozens of active exploitation attempts across the globe. In many cases, attackers successfully retrieved credentials for instances running legacy or poorly configured applications. Some breaches led to data exfiltration from S3 buckets, while others allowed attackers to launch additional compute instances, thereby extending the foothold within the victim’s AWS environment.
Beyond immediate data loss, the long‑term damage includes compliance violations, reputational harm, and costly incident response efforts. The fact that the flaw resides in a widely used open‑source utility underscores the need for vigilant dependency management in cloud workloads.
Mitigation Strategies
Security teams can employ a multi‑layered defense to thwart this type of attack:
1. Patch Pandoc Promptly
Version 2.19.2 and later contain a fix that removes the SSRF vector. Updating the library in all CI/CD pipelines, Docker images, and serverless functions is the simplest and most effective step.
2. Restrict IMDS Access
Use the IMDSv2 token requirement to add a mandatory token hop. This reduces the risk of unauthenticated SSRF exploits reaching the metadata endpoint.
3. Limit IAM Role Scope
Follow the principle of least privilege. Assign IAM roles with only the permissions needed for the instance’s function. If an instance is dedicated to a single task, its role should not include broad services like S3 or RDS.
4. Network Segmentation and WAF Rules
Place a network firewall or WAF in front of your instances. Block outbound traffic to 169.254.169.254 unless the request originates from a trusted process.
5. Monitor for Anomalous Metadata Requests
Enable CloudWatch logs for IMDS usage. An unexpected spike in metadata API calls can be an early warning sign of exploitation.
Best Practices for Secure Pandoc Usage
- Validate all input URLs before passing them to Pandoc.
- Run Pandoc inside a sandboxed environment (e.g., containers with reduced network privileges).
- Regularly audit third‑party dependencies using tools like Snyk or GitHub Dependabot.
- Implement continuous integration checks that flag any inclusion of outdated or vulnerable libraries.
What It Means for Your Cloud Strategy
Cloud-native developers often assume that the underlying infrastructure is secure by default. The Pandoc SSRF incident proves otherwise: a flaw in a user‑land utility can unlock privileged cloud services. Building a security posture that anticipates such indirect attack vectors is essential.
Key takeaways include:
- Dependency hygiene is critical. Even a single third‑party tool can become an attack vector if left unpatched.
- Least privilege is not optional. IAM roles must be tightly scoped to limit damage if credentials are compromised.
- Layered defenses matter. Combining patching, IAM hardening, IMDSv2 enforcement, and network segmentation creates a robust security perimeter.
Looking Ahead
As cloud environments grow more complex, the attack surface expands. Attackers will continue to search for overlooked components—like Pandoc—that can be leveraged against critical services. Organizations must stay vigilant by continuously scanning for new CVEs, promptly applying patches, and re‑evaluating their IAM policies to stay ahead of threat actors.
Security is a perpetual game of adaptation. The Pandoc CVE‑2025‑51591 episode is a stark reminder that even the most benign tools can become weapons in the wrong hands. By prioritising patch management, IAM least‑privilege, and robust monitoring, you can protect your AWS workloads from this and future SSRF‑driven threats.


