Skip to content
RCE Write-up Intermediate

How I got $24000 Bounty from a Log4j RCE in Apple App Store.

A city name input field in the Apple App Store region settings was logged by a backend that used a vulnerable version of the Log4j logging library. By entering a crafted string, an attacker could make the server run commands and leak its hostname and operating system details.

Mehar huzaifa Follow

Published on medium.com

Bounty$24,000 View original

Log4j is a popular Java-based logging library used by many organizations to log activity on their servers. The Log4j RCE vulnerability was disclosed in December 2021, which allows attackers to execute arbitrary code on a server running the vulnerable version of Log4j by sending a specially crafted string.

Mehar huzaifa, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target was the Apple App Store, specifically the region settings feature on the iPhone. When a user changes their region, the interface presents an input field for the city name. That value is submitted to Apple's backend systems, where, according to the report, it was logged by a Java application using Log4j.

Log4j is a widely used Java logging library. The Log4Shell vulnerability, tracked as CVE-2021-44228 and disclosed in December 2021, lets an attacker execute arbitrary code on a server running a vulnerable version by sending a specially crafted string that the server logs. The report notes that the vulnerability caused widespread concern because it is simple to exploit and Log4j is so widely deployed.

Setup

The researcher, Huzaifa, describes himself as a cybersecurity researcher and bug hunter, and this is his first write-up. No special tooling is described beyond an iPhone and a server he controlled that could send him email notifications. The precondition for the test was simply the ability to change region settings in the App Store and to enter a value in the city field. The server he controlled was used as the listener: if the payload triggered, it would make an outbound request that he would observe as an email notification.

Finding it

On a routine day the researcher picked up his iPhone to change his region settings. While doing so he noticed the input field for the city name. Given his background in security research and the ongoing concerns around Log4j, he decided to test whether the App Store might still be vulnerable. The reasoning was straightforward: a free-text field that reaches a Java backend is exactly the kind of input that ends up in a log line, and if that backend still ran a vulnerable Log4j version, a lookup string in the field would be resolved when logged.

Exploitation

Step 1: Inject the payload in the city field

He entered a Log4j payload in the city input field and proceeded to change his region. The report does not reproduce the exact payload string used in this first attempt. Initially nothing seemed to happen, and he received no indication that the payload had triggered.

Step 2: Observe the trigger

Later that evening he went to the App Store to download a game. As the game began downloading, he unexpectedly received an email notification from his server indicating that the Log4j payload had been triggered. The trigger came later, when a game download began, not at the moment of submission.

From the original on medium.com

The notification email also revealed the hostname of the App Store server, giving him a piece of information about the backend host.

Step 3: Confirm command execution

After that, he modified the payload to execute commands such as sys:os.name and sys:os.version. These commands executed successfully and provided detailed information about the operating system running on the App Store's server. This confirmed that the input provided earlier in the city field had been logged and subsequently executed, which he describes as a severe vulnerability in the App Store's backend systems.

Root cause

The report attributes the issue to the App Store backend running a vulnerable version of Log4j and logging user-controlled input from the city field. When a logged string contains a Log4j lookup, the library resolves it, and in the vulnerable version this resolution can reach out to an attacker-controlled endpoint and, per the report, execute commands. The report does not describe the specific logging configuration, the Log4j version, or any mitigation that was in place, so the precise reason existing defences did not stop it is not stated.

Impact

The researcher frames the impact in terms of the platform's reach: a vulnerability in a platform like the Apple App Store could have led to severe security breaches affecting millions of users. In his test the payload executed on the App Store server and returned operating system details, and the notification email disclosed the server hostname. The report does not go further into what an attacker could reach from that execution context, so the full blast radius is not established here.

Fix

The report gives a timeline rather than a description of the code change:

Date Event
April 05, 2022 Initial report
April 14, 2022 Triaged
April 19, 2022 Fixed
April 29, 2022 Bounty awarded

The timeline lists triage on April 14, fixed on April 19 and bounty awarded on April 29. The report does not say what was changed. He also received formal acknowledgment from Apple's Product Security team, and links to an Apple support page dated April 2022.

From the original on medium.com

At the end of the one-month process he received the email shown above and was rewarded a $24000 bounty.

Variants to test

  1. Free-text profile and settings fields that reach a Java backend: city, region, display name, address lines.
  2. Fields whose values are logged later, as here where the trigger came when a game download started. Submit the payload, then perform unrelated actions in the app and watch the listener for delayed callbacks.
  3. Lookup strings that disclose environment data, such as sys:os.name and sys:os.version, to confirm execution rather than a mere DNS callback. A positive result is the operating system details appearing in your listener or notification.
From the original on medium.com

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

What happened, in plain words

A security researcher found a serious bug in the Apple App Store. He typed a special piece of text into the "city" field of the iPhone's region settings. Later, when he downloaded a game, his own server received a message showing that the App Store's computers had processed that text. He reported it to Apple, Apple fixed it, and he was paid $24,000.

The bug is called Log4Shell. It lives in a piece of software called Log4j, which many servers use to write diaries (logs) of what happens. If a server writes down text that contains a special instruction, an old version of Log4j will follow that instruction, which can let an outsider run commands on the server.

This article walks through the same story for someone who has never done security testing. It explains the terms as they appear and describes what the researcher did.

Background: what is Log4j and what is Log4Shell?

Log4j is a Java library. A library is a bundle of code that programmers reuse instead of writing everything themselves. Java is a programming language often used for large server systems. Log4j's job is logging: writing a record of events, such as "user changed region" or "file downloaded", into a file or a monitoring system. Think of it as a diary that a server keeps automatically.

Log4Shell is the name given to a bug in Log4j, officially tracked as CVE-2021-44228. CVE is a public catalogue number for known vulnerabilities. The bug was disclosed in December 2021. It lets an attacker run arbitrary code on a server that uses a vulnerable version of Log4j, simply by sending a specially crafted string that the server later logs. "Arbitrary code" means any command the attacker chooses, not just the one the program intended.

The report notes that this bug caused widespread concern because it is simple to exploit and Log4j is used almost everywhere. In everyday terms: imagine a diary that, whenever you write the word "open the door", actually opens the door. If you can get someone to write that phrase in the diary, you control the door.

The target and the setup

The target was the Apple App Store, specifically the region settings on an iPhone. When you change your region (the country associated with your account), the iPhone shows a form that includes a city name field. That value is sent to Apple's backend systems. Backend means the servers behind the app, which you never see; your phone is the front end, and the servers do the real work.

According to the report, the city value was logged by a Java application using Log4j. That is the key: a field you can type into ended up in a log line.

The researcher, Huzaifa, describes himself as a cybersecurity researcher and bug hunter, and this is his first write-up. He used an iPhone and a server he controlled. That server could send him email notifications. In security testing, a server you control that waits for a connection from the target is called a listener. If the target's server is tricked into contacting your listener, you know the payload worked. The email was simply how the listener told him about the incoming connection.

No other tooling is described. The precondition was just the ability to change region settings and type in the city field.

Finding it

On a routine day he picked up his iPhone to change his region settings. While doing so he noticed the city input field. Because he knew about Log4j and the industry was still dealing with Log4Shell, he decided to test whether the App Store might still be vulnerable.

His reasoning was simple: a free-text field that reaches a Java backend is exactly the kind of input that ends up in a log line. If that backend still ran a vulnerable Log4j version, a special lookup string in the field would be resolved when the value was logged. A lookup string is a piece of text that Log4j treats as an instruction rather than plain text. In the vulnerable version, one kind of lookup can make the server fetch something from a remote address, which is how the attacker gets a signal out.

Exploitation

Step 1: Put the payload in the city field

He entered a Log4j payload in the city input field and then changed his region. The report does not reproduce the exact payload string used in this first attempt. A payload is the specially crafted input you send to trigger a bug.

At first nothing seemed to happen, and he saw no sign that the payload had triggered. This is common in this kind of test: the effect may be delayed, or it may happen on a different server than the one handling your request.

Step 2: See the trigger

Later that evening he opened the App Store to download a game. As the game began downloading, he unexpectedly received an email notification from his server saying the Log4j payload had been triggered.

From the original on medium.com

The trigger came later, when a game download began, not at the moment he pressed the button. The notification email also revealed the hostname of the App Store server. A hostname is the name a computer uses on a network, like a street address for a machine. Seeing it gave him a detail about the backend host.

Step 3: Confirm that commands run

After that, he changed the payload to run commands such as sys:os.name and sys:os.version. These are Log4j lookups that return information about the operating system. They executed successfully and gave him details about the operating system running on the App Store's server.

This confirmed that the input from the city field had been logged and then executed. He describes it as a severe vulnerability in the App Store's backend systems.

Why it worked (root cause)

The report attributes the issue to the App Store backend running a vulnerable version of Log4j and logging user-controlled input from the city field. When a logged string contains a Log4j lookup, the library resolves it. In the vulnerable version, that resolution can reach out to an endpoint controlled by the attacker and, per the report, execute commands.

The report does not describe the specific logging configuration, the Log4j version, or any mitigation that was in place, so the precise reason existing defences did not stop it is not stated.

Impact

The researcher frames the impact in terms of the platform's reach: a vulnerability in a platform like the Apple App Store could have led to severe security breaches affecting millions of users. In his test the payload executed on the App Store server and returned operating system details, and the notification email disclosed the server hostname. The report does not go further into what an attacker could reach from that execution context, so the full blast radius is not established here.

The fix and the timeline

The report gives a timeline rather than a description of the code change:

Date Event
April 05, 2022 Initial report
April 14, 2022 Triaged
April 19, 2022 Fixed
April 29, 2022 Bounty awarded

Triaged means the security team reviewed the report and confirmed it was valid. The timeline lists triage on April 14, fixed on April 19 and bounty awarded on April 29. The report does not say what was changed. He also received formal acknowledgment from Apple's Product Security team, and links to an Apple support page dated April 2022.

From the original on medium.com

At the end of the one-month process he received the email shown above and was rewarded a $24,000 bounty. A bounty is a payment a company makes to someone who reports a security bug responsibly.

Other places to test the same idea

  1. A positive result is an out-of-band interaction from Apple infrastructure to your listener after the value is saved or after a later action triggers the log write. Out-of-band means the signal comes back through a different channel, here the connection from Apple's server to the researcher's listener, rather than in the normal response.
  2. Fields whose values are logged later, as here where the trigger came when a game download started. Asynchronously means later, not immediately. Submit the payload, then do unrelated things in the app and watch the listener for delayed callbacks.
  3. Lookup strings that disclose environment data, such as sys:os.name and sys:os.version, to confirm execution rather than a mere DNS callback. A positive result is the operating system details appearing in your listener or notification. DNS is the system that turns names like example.com into network addresses; a DNS callback only proves a lookup happened, not that code ran.
From the original on medium.com

Glossary

  • Log4j: a Java library that writes log messages for a server.
  • Java: a programming language commonly used for server applications.
  • Library: a reusable bundle of code that programmers include in their programs.
  • Logging: automatically recording events in a file or monitoring system.
  • Log4Shell: the name for the Log4j vulnerability tracked as CVE-2021-44228.
  • CVE: a public catalogue number for a known vulnerability.
  • Remote Code Execution (RCE): a bug that lets an attacker run their own commands on someone else's server.
  • Payload: the specially crafted input sent to trigger a vulnerability.
  • Lookup string: text that Log4j treats as an instruction rather than plain text.
  • Backend: the servers behind an app that do the real work, which users do not see.
  • Front end: the part of a system users interact with, such as an iPhone app.
  • Listener: a server you control that waits for connections so you can detect when a target contacts it.
  • Hostname: the name a computer uses on a network.
  • Out-of-band: a signal that comes back through a different channel than the normal response.
  • Asynchronously: happening later, not immediately.
  • DNS: the system that translates names into network addresses.
  • Triaged: reviewed and confirmed as valid by a security team.
  • Bounty: a payment made by a company for a responsibly reported security bug.
  • Blast radius: how much an attacker could reach or damage from a given point of access.

More from Apple

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.