remote code execution when open a project in android studio that google refused to fix
Android Studio downloads and extracts a Gradle distribution specified in a project's gradle-wrapper.properties file, and a bundled library executes a command that can run a cmd.exe placed in the project directory. An attacker could send a malicious project to a victim and achieve code execution on the victim's PC when the project is opened.
When you open a project in android studio, if gradle-wrapper.properties set distributionUrl=https\:// services.gradle.org/distributions/gradle-2.6-all.zip <https://www.google.com/url?q=http://services.gradle.org/distributions/gradle-2.6-all.zip&sa=D&usg=AFQjCNHSuogmDHXLFUDcfXdMkVSqzfLug>, then android studio will…
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.
What the report shows

The report was sent to the Full Disclosure mailing list on 21 December 2020 and describes a remote code execution issue in Android Studio that the researcher says was still unfixed at the time of writing. The researcher linked a video and proof of concept alongside the text.
The mechanism, as described, is triggered by opening a project. If the project's gradle-wrapper.properties sets the Gradle distribution URL to the 2.6 all distribution, Android Studio downloads and extracts gradle-2.6-all.zip, and jar files inside that zip are executed by java.exe. The report gives the setting as:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
Among the extracted libraries is plexus-interpolation-1.14.jar under gradle-2.6\lib\plugins. The researcher points to the matching source release on Maven Central and to OperatingSystemUtils.java in the org.codehaus.plexus.interpolation.os package, where the code contains a call of the form:
exec( "cmd.exe /c set" );
The report states that studio64.exe creates java.exe from the bundled JRE and that this java.exe runs with the project directory as its working directory. Because of that, a cmd.exe placed in the project directory is the one that gets executed. The attacker's route is therefore to send a malicious project to a victim and have the victim open it.
The timeline in the report:
| Date | Event |
|---|---|
| 25 Nov 2020 | Reported to the Google VRP; receipt confirmed the same day |
| 26 Nov 2020 | Triaged |
| 28 Nov 2020 | Google says the issue might not be severe enough for a reward, pending the panel meeting |
| 16 Dec 2020 | Google says the team has been notified and will decide whether to change anything; the panel decided the security impact does not meet the criteria for a reward |
| 16 Dec 2020 | Researcher asks why there is no bounty; Google replies that opening untrusted code in an IDE is inherently insecure and that build systems generally allow code execution when an attacker controls configuration files |
The researcher disagreed, arguing that the code runs on opening the project without any build or debug step, that every file in the proof of concept looks normal apart from cmd.exe (which an attacker could mark hidden), and that an APK cannot run on a PC, unlike the situation with Xcode or Visual Studio. Google's final position, quoted in the report, was that the Android versus desktop IDE distinction does not make much difference, that the emulator is not a security boundary, and that projects are built upon opening as a prerequisite for the IDE's features. The researcher then asked for public disclosure, which Google agreed to. No bounty, severity rating or fix is recorded in the report.
Root cause
The report points to a working-directory problem. A library in the extracted Gradle distribution runs a command by bare name, and the JVM's working directory is the opened project. Because the IDE starts the JVM inside the opened project, the project directory is the current directory, and a file the attacker placed there wins the lookup. The report shows the command is run by bare name while the JVM's working directory is the opened project, but it does not analyse why the lookup resolves there.
Impact
An attacker who convinces a victim to open a crafted project can execute code on the victim's machine at the moment the project is opened, with the privileges of the IDE's Java process. The report stresses that no build, debug or other action is needed. It does not describe persistence, privilege escalation or what the payload does beyond running.
How this kind of bug works
This is a search-path or working-directory hijack. When a process launches another program by a relative name, the operating system searches a list of locations. On Windows the current directory is traditionally searched early, before directories listed in PATH. Any process that sets its working directory to content an attacker can write therefore turns every relative program launch into a potential execution primitive. The same pattern appears with DLL and library loading, where a relative or unqualified name is resolved against the application directory or the current directory. Defences are straightforward in principle: launch helpers by absolute path, set the child process working directory to a trusted location, and remove the current directory from the search order where the platform allows it. Application allow-listing and code-signing policies reduce the payoff but do not remove the primitive.
How to test for it
- Identify features where a user-supplied file, archive or project is opened and a helper process is started as a consequence: IDE project imports, build tools, archive extractors, document converters, installers and plugin loaders.
- Determine the working directory of the spawned process. On Windows, process monitors that show the image path and command line, plus the process working directory, are the quickest way.
- Place a harmless marker executable with the name of a helper the application is known to launch into the directory the user controls, and observe whether it runs. Use a program that writes a file or prints a marker rather than anything destructive.
- Repeat with the marker in subdirectories and with names taken from the application's own logs, error messages and bundled libraries.
- A positive result is the marker executing without any further user action beyond opening the file. Common false positives are the application resolving the helper through an absolute path anyway, the marker being blocked by policy, or the execution only happening after an explicit build step, which changes the threat model.
How it is fixed
Resolve helper programs by absolute path, or invoke them through an API that does not consult the current directory. Set the working directory of child processes to a trusted location. Where the platform supports it, disable current-directory lookup for the process. Vendors may also choose to warn users before opening untrusted projects, though the report shows Google arguing that this does not remove the underlying behaviour.
Hunting notes
This class hides in any workflow that mixes attacker-controlled files with process launches: project and workspace formats, build configuration, package managers, archive handling and plugin systems. Recon signals include bundled third-party libraries that shell out, log lines naming helper executables, and documentation that says a tool runs commands on open. To make a report land, show execution with no extra user action, keep the payload benign and clearly marked, and demonstrate the exact file the victim would receive. Where a vendor argues the behaviour is by design, a clear statement of the trust boundary being crossed, and of what the user is led to believe when opening the file, is the strongest evidence you can offer.
What happened, in plain words

This is a message posted to a public mailing list, Full Disclosure, on 21 December 2020. The author, houjingyi, describes a way to make code run on someone's computer when they open a project in Android Studio, Google's program for building Android apps. He says Google decided not to pay a reward, and that the problem was still present when he wrote the message. He also linked a video and proof of concept, a small demonstration that shows the problem really works.
The idea in everyday terms
Imagine a builder who is told to fetch a tool called "hammer" from the toolbox in the room they are standing in, rather than from the workshop store. If a stranger can slip their own "hammer" into that room, the builder picks up the stranger's tool without noticing. That is roughly what happens here: a program asks the computer to run a helper by a short name, and the folder the user just opened is the working directory.
The technical steps
Android Studio projects contain a settings file called gradle-wrapper.properties. Gradle is the tool that assembles an Android app from its source files. That file tells Android Studio which version of Gradle to download. The report says that if the file contains this line:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
Android Studio downloads and unpacks gradle-2.6-all.zip. Jar files inside that zip are then executed by java.exe, the Java runtime that ships with the IDE. Among the unpacked libraries is plexus-interpolation-1.14.jar, found under gradle-2.6\lib\plugins. The researcher looked at the matching source code, in OperatingSystemUtils.java inside the org.codehaus.plexus.interpolation.os package, and found a call of this form:
exec( "cmd.exe /c set" );
This asks Windows to start cmd.exe, the command prompt, and run the set command, which lists environment variables. The important part is that cmd.exe is named without a full folder path. The report states that studio64.exe starts java.exe from the bundled Java runtime, and that this java.exe runs with the opened project folder as its working directory. So when the computer looks for cmd.exe, one placed in the project folder is the one that gets executed. An attacker can therefore send a malicious project to a victim, and the attacker's cmd.exe runs as soon as the victim opens it.
What Google said
The report lists the exchange:
| Date | Event |
|---|---|
| 25 Nov 2020 | Reported to the Google bug reward programme; receipt confirmed the same day |
| 26 Nov 2020 | Triaged, meaning Google accepted it for review |
| 28 Nov 2020 | Google says it might not be severe enough for a reward, pending a panel meeting |
| 16 Dec 2020 | Google says the team will decide whether to change anything; the panel decided the impact does not meet the criteria for a reward |
| 16 Dec 2020 | The researcher asks why there is no bounty; Google replies that opening untrusted code in an IDE is inherently insecure and that build systems generally allow code execution when an attacker controls configuration files |
The researcher disagreed. He argued that the code runs on opening the project, with no build or debug step needed; that every file in his demonstration looks normal apart from cmd.exe, which an attacker could also mark hidden; and that an Android app package cannot run on a PC, so the situation differs from Xcode or Visual Studio. Google's final position, quoted in the report, was that the Android versus desktop distinction does not make much difference, that the emulator is not a security boundary, and that projects are built upon opening as a prerequisite for the IDE's features. The researcher asked for public disclosure and Google agreed. No bounty, severity rating or fix is recorded.
In general, how this kind of bug works
This is a search-path or working-directory hijack. When a program starts another program by a short name, the operating system searches a list of places for it. On Windows, the current directory has traditionally been searched early, before the folders listed in the PATH environment variable. Any program that sets its working directory to a folder an attacker can write to therefore turns every short-name launch into a possible way to run attacker code. The same pattern appears with shared libraries: a library named without a full path may be loaded from the application folder or the current directory.
The defences are simple in principle: start helper programs by their full path, set the working directory of child processes to a trusted location, and remove the current directory from the search order where the platform allows it. Allow-listing and code-signing make an attack less useful but do not remove the underlying weakness.
How to test for it
- Look for features where a file, archive or project supplied by a user is opened and a helper program is started as a result: IDE project imports, build tools, archive extractors, document converters, installers and plugin loaders.
- Find out which folder the started program treats as its current directory. On Windows, a process monitor that shows the program path, the command line and the working directory is the quickest way.
- Put a harmless marker program, named after a helper the application is known to start, into the folder the user controls, and see whether it runs. Use something that writes a file or prints a marker, never anything destructive.
- Repeat with the marker in subfolders and with names taken from the application's own logs, error messages and bundled libraries.
- A positive result is the marker running with no further action beyond opening the file. Common false positives are the application using a full path anyway, security policy blocking the marker, or the code only running after an explicit build step, which changes the threat model.
How it is fixed
Start helper programs by full path, or use an interface that does not consult the current directory. Set the working directory of child processes to a trusted location. Where the platform supports it, turn off current-directory lookup for the process. A vendor may also warn users before opening untrusted projects, though the report shows Google arguing that this does not remove the underlying behaviour.
Where to look
This class of bug hides in any workflow that mixes attacker-controlled files with program launches: project and workspace formats, build configuration, package managers, archive handling and plugin systems. Useful signals include bundled third-party libraries that start other programs, log lines naming helper programs, and documentation saying a tool runs commands on open. To make a report convincing, show execution with no extra user action, keep the payload harmless and clearly marked, and show the exact file the victim would receive. Where a vendor argues the behaviour is by design, a clear statement of the trust boundary being crossed, and of what the user is led to believe when opening the file, is the strongest evidence you can offer.
Glossary
- Android Studio: Google's program for writing and building Android apps on a computer.
- APK: the installable package format for Android apps; it runs on Android devices, not on a PC.
- Bounty: a payment a company makes to someone who reports a security problem.
- Build: the process of turning source files into a finished program or app.
- Command prompt (
cmd.exe): the Windows program that runs typed commands. - Current directory / working directory: the folder a running program treats as its starting point for finding files.
- DLL: a shared library on Windows, code that several programs can use.
- Emulator: software that imitates a device, here an Android phone, on a computer.
- Environment variables: named settings the operating system keeps for programs; the
setcommand lists them. - Full Disclosure: a public mailing list where security problems are published.
- Gradle: the build tool Android Studio uses to assemble an app.
- IDE: integrated development environment, a program for writing, running and debugging code.
- Jar: a zip file containing Java code and resources.
- Java /
java.exe: a programming language and the runtime that executes its programs. - JVM: the Java virtual machine, the part of the runtime that runs Java code.
- Maven Central: a public repository of Java libraries.
PATH: the list of folders the operating system searches for programs when only a short name is given.- Proof of concept (POC): a small demonstration showing that a problem is real.
- Remote code execution (RCE): making someone else's computer run code of your choosing.
- Search-path hijack: tricking a program into running a different file with the same name by placing it earlier in the search order.
- Security boundary: a line the system promises attackers cannot cross.
- Triaged: reviewed and accepted as a genuine report by the receiving team.
- Trust boundary: the point where data or files from a less trusted source enter a more trusted part of the system.
- VRP: Vulnerability Reward Program, Google's bug bounty scheme.
- Xcode / Visual Studio: Apple's and Microsoft's development environments for their platforms.
- 0day: a security problem with no fix available at the time it is known.