A Tale Of 5250$: How I Accessed Millions Of User’s Data Including Their National ID’s
Two publicly accessible S3 buckets belonging to Tecno were found, containing internal files and user data including national IDs. An attacker could download all the data from these buckets.
Hi, Hope you guys are doing well, And a Happy New Year, YAY! ✨, Let’s start the blog without wasting more time.
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
This write-up covers a bug bounty engagement against the Tecno source code program, where the researcher hunted for exposed cloud storage referenced from the source code of the vendor's Android applications. The scope was large: the researcher collected the applications in scope and decompiled them to search the resulting files for secrets and references to cloud resources. The weakness class is AWS misconfiguration leading to information disclosure, and the disclosed bounty was 5250 USD.
The report does not describe any particular application feature or user-facing endpoint. The target of the finding is not an HTTP endpoint at all but an S3 bucket referenced from the decompiled application files.
Setup
The researcher worked from the decompiled output of the Android applications in scope, using three tools:
- apktool, to decompile APK files.
- nuclei, to run automated checks over the decompiled files.
- mobile-nuclei-templates, a set of nuclei templates aimed at mobile application artefacts, which includes checks for S3 buckets.
The report does not state the versions of any of these tools, nor the number of applications beyond "about 50+". No accounts or roles were needed: the finding is in publicly reachable cloud storage, and the only precondition was access to the APK files in scope.
Finding it
Rather than reading the decompiled output of each application by hand, the researcher decompiled everything at once and then ran nuclei across the whole output directory. The reasoning is straightforward: with dozens of applications, manual review does not scale, and the mobile templates already encode the checks worth running against decompiled APK content, including S3 bucket discovery.
Step 1: decompile every APK in one pass
find . -iname "*.apk" -exec apktool d -o {}_out {} \;
This walks the current directory, matches every file whose name ends in .apk regardless of case, and runs apktool d on each one, writing the decompiled output into a directory named after the APK with an _out suffix. The researcher notes that decompiling this many applications takes a considerable amount of time.
Step 2: run nuclei over the decompiled tree
nuclei -target /path-to-output-folder/"android testing"/allapks/ -t /path-to-tamplates/mobile-nuclei-templates/
-target points at the directory holding all the decompiled applications, and -t points at the mobile nuclei templates. Nuclei then applies those templates to the files in that tree. The run took roughly 18 to 19 minutes.
Step 3: triage the first hit
Nuclei reported S3 Bucket Found. The researcher tried to access that bucket through the AWS CLI and received Access denied. That bucket was a dead end.
Step 4: triage the second hit
A few minutes later nuclei produced a second S3 bucket result. This time the bucket was readable and contained internal files, user data and more. The researcher describes being able to download everything, including the whole bucket, and shows a glimpse of the data as evidence that the bucket was worth reporting. At that point the researcher stopped looking further, citing bug bounty rules, and reported to the team.
Step 5: a second bucket, and a merge
After the first report, nuclei surfaced one more S3 bucket, which held about 4 to 5 GB of data. That one was reported as well. The team responded that both S3 buckets were managed by the same team and merged the second report into the first. The researcher disagreed and tried to argue against the merge, but the merge stood. The team added 25 reputation points on the program and moved the report to critical severity. The researcher received 5250 USD for the first report and nothing for the second.
The researcher states that no file was downloaded from either bucket. One file was downloaded from a Tecno server solely to attach it to the vulnerability report. The server was subsequently fixed and, according to the researcher, no one has access to the data any more.
Root cause
The applications in scope referenced S3 buckets that were reachable without authentication, and the bucket names were recoverable from the decompiled APK content, which is what the mobile nuclei templates detect. In practice this is the familiar pattern: storage that is meant to be internal is created or left readable by anyone who knows the bucket name, and the name is embedded in a client-side artefact that anyone can download and decompile. Because the bucket name is the only thing standing between an outsider and the contents, there is no defence left once the name leaks.
Impact
The readable bucket exposed internal files and user data, and the researcher could download the entire bucket. The second bucket held about 4 to 5 GB of data, which the researcher describes as sensitive. The exposure is conditional on knowing the bucket name, which the decompiled applications supplied. The report does not enumerate which user records or how many were affected beyond the claim in the title.
Fix
The report says the server was fixed and that no one has access to the data any more. The general remediation for this class is to remove public read access from the buckets, restrict access to authorised principals, and audit the remaining buckets referenced from the applications for the same condition.
Variants to test
- Decompile and scan other mobile applications in scope. Run the same
find/apktool/nucleipipeline over a different application set. A positive result is an S3 bucket name reported by the mobile templates that resolves to a readable bucket. - Check every bucket name found, not just the first. The first hit here returned Access denied while the second was open. A positive result is a bucket that lists objects or serves files without credentials.
- Look beyond S3. Decompiled APKs commonly embed other cloud storage references and API keys. A positive result is any storage or service reference that responds without authentication.
- Try the AWS CLI against each candidate. A positive result is a successful listing or object retrieval where the first bucket in this report returned Access denied.
- Repeat on other client-side artefacts. The same names can appear in JavaScript bundles and configuration files shipped to clients. A positive result is a bucket name recovered from a public artefact that leads to readable storage.
What happened, in plain words
A security researcher was taking part in a bug bounty programme run by Tecno, the phone maker. A bug bounty programme is a deal offered by a company: if you find a security problem in our systems and tell us about it privately, we will pay you a reward (the bounty) instead of getting angry. The researcher's job here was to look through the source code of Tecno's Android applications, the apps you install on a phone, and see whether any of them accidentally pointed at cloud storage that anyone on the internet could read.
That is exactly what happened. Inside the apps' code were references to storage space in Amazon's cloud, called S3 buckets. An S3 bucket is like a shared folder in the cloud: a company puts files in it, and the files can be reached over the internet if the folder's permissions are set that way. Two of these buckets turned out to be readable by anyone who knew their names, and the names were sitting inside the apps themselves. The researcher could list and download the contents, which included internal files and user data. The first report earned 5250 USD. A second bucket was found afterwards, but the company merged that report into the first and paid nothing extra for it, adding 25 reputation points instead and marking the report critical.
The weakness class is an AWS misconfiguration that leads to information disclosure. In plain terms: a cloud setting was left too open, and as a result information that should have been private could be read by outsiders.
The report does not describe any particular app feature or web address that users visit. The thing that was exposed was not a website page at all, but a cloud storage folder that the app's code mentioned.
Setting up
The researcher worked on the decompiled output of the Android apps in scope. "Decompiling" means taking a finished app file and turning it back into something close to readable source code, so you can see the text inside it: names, addresses, settings. The tools used were:
- apktool, which does the decompiling of APK files. An APK is the file format of an Android app, the thing you download from an app store.
- nuclei, an automated scanner. You give it a list of checks (called templates) and a place to look, and it runs them for you instead of you checking by hand.
- mobile-nuclei-templates, a collection of nuclei checks written for mobile app material, which includes checks that spot S3 bucket names.
The report does not give the versions of any of these tools, and it only says there were "about 50+" applications. No accounts or special roles were needed: the finding is in cloud storage that anyone can reach, and the only precondition was having the APK files in scope.
Finding it
Reading the decompiled output of every app by hand was not realistic. With dozens of apps, manual review does not scale, and the mobile templates already contain the checks worth running against decompiled app content, including S3 bucket discovery. So the researcher decompiled everything in one go and then ran nuclei across the whole output folder.
Step 1: decompile every APK in one pass
find . -iname "*.apk" -exec apktool d -o {}_out {} \;
Line by line, in plain words:
find .means "search starting from the current folder and everything inside it".-iname "*.apk"means "match files whose name ends in.apk, ignoring upper and lower case". The*stands for any characters before the extension.-exec ... \;means "for every file you matched, run the following command on it".apktool dis the decompile command of apktool.dis short for decompile.-o {}_outtells apktool where to write the result: a folder named after the matched file with_outadded. The{}is replaced by the file name thatfindmatched.- The final
{}is the input file, the APK itself.
The researcher notes that decompiling this many apps takes a considerable amount of time. The reason for doing it all at once is simple: one command handles every app, and the output is then in one place for the scanner.
Step 2: run nuclei over the decompiled tree
nuclei -target /path-to-output-folder/"android testing"/allapks/ -t /path-to-tamplates/mobile-nuclei-templates/
Line by line:
nucleistarts the scanner.-targetpoints at the folder to scan. Here it is the folder holding all the decompiled apps. The quotes around"android testing"keep the space in the folder name together as one item.-tpoints at the templates to use, here the mobile nuclei templates folder.
Nuclei then applies those templates to the files in that folder tree. The run took roughly 18 to 19 minutes. The reason for this step is the same as before: let the machine do the repetitive checking across thousands of files.
Step 3: look at the first hit
Nuclei reported S3 Bucket Found. The researcher tried to open that bucket through the AWS CLI and got Access denied. The AWS CLI is Amazon's command line tool for talking to its cloud services; it lets you list and fetch files from a bucket from a terminal. Access denied means the bucket existed but would not let this outsider in. That bucket was a dead end.
Step 4: look at the second hit
A few minutes later nuclei produced a second S3 bucket result. This time the bucket was readable and contained internal files, user data and more. The researcher describes being able to download everything, including the whole bucket, and shows a glimpse of the data as evidence that the bucket was worth reporting. At that point the researcher stopped looking further, citing bug bounty rules, and reported to the team. The reason to stop is that bounty rules usually ask you to prove the problem and not to go rummaging through real people's data.
Step 5: a second bucket, and a merge
After the first report, nuclei surfaced one more S3 bucket, which held about 4 to 5 GB of data. That one was reported as well. The team responded that both S3 buckets were managed by the same team and merged the second report into the first. The researcher disagreed and tried to argue against the merge, but the merge stood. The team added 25 reputation points on the programme and moved the report to critical severity. The researcher received 5250 USD for the first report and nothing for the second.
The researcher states that no file was downloaded from either bucket. One file was downloaded from a Tecno server solely to attach it to the vulnerability report. The server was subsequently fixed and, according to the researcher, no one has access to the data any more.
Why it was possible
The apps in scope mentioned S3 buckets that could be reached without logging in, and the bucket names could be recovered from the decompiled app content, which is what the mobile nuclei templates detect.
In practice this is a familiar pattern. Storage that is meant to be internal is created, or left, readable by anyone who knows the bucket name, and the name is embedded in something that ships to every user: the app itself. Anyone can download an app and decompile it. Because the bucket name is the only thing standing between an outsider and the contents, there is no defence left once the name leaks. A useful comparison: it is like putting your files in a locker whose only lock is that nobody knows the locker number, and then printing the number on the outside of the locker.
What was at risk
The readable bucket exposed internal files and user data, and the researcher could download the entire bucket. The second bucket held about 4 to 5 GB of data, which the researcher describes as sensitive. A national ID is an official document number that identifies a person, so its exposure is serious. The exposure depends on knowing the bucket name, which the decompiled apps supplied. The report does not list which user records or how many were affected beyond the claim in the title.
The fix
The report says the server was fixed and that no one has access to the data any more. The general remedy for this class of problem is to remove public read access from the buckets, restrict access to authorised accounts, and audit the remaining buckets mentioned in the apps for the same condition.
Other things worth testing
- Decompile and scan other mobile apps in scope. Run the same
find/apktool/nucleipipeline over a different set of apps. A positive result is an S3 bucket name reported by the mobile templates that turns out to be readable. - Check every bucket name found, not just the first. The first hit here returned Access denied while the second was open. A positive result is a bucket that lists files or serves them without credentials.
- Look beyond S3. Decompiled APKs commonly contain other cloud storage references and API keys. An API key is a secret string that lets software talk to a service on your behalf. A positive result is any storage or service reference that answers without authentication.
- Try the AWS CLI against each candidate. A positive result is a successful listing or file download where the first bucket in this report returned Access denied.
- Repeat on other files that ship to users. The same names can appear in JavaScript bundles and configuration files sent to browsers. A positive result is a bucket name recovered from a public file that leads to readable storage.
Glossary
- Bug bounty programme: a scheme where a company pays people who privately report security problems in its systems.
- Bounty: the money paid for a valid report.
- Scope: the list of systems a programme allows you to test.
- Android application / APK: an app for Android phones; APK is the file format you install.
- Decompile: turn a finished program file back into readable text so you can inspect it.
- apktool: a tool that decompiles APK files.
- nuclei: an automated scanner that runs a set of checks against a target.
- Template: a single check written for nuclei, describing what to look for.
- mobile-nuclei-templates: a collection of nuclei checks aimed at mobile app material, including S3 bucket discovery.
- S3 bucket: a storage folder in Amazon's cloud that files can be put into and fetched from over the internet.
- AWS: Amazon Web Services, Amazon's cloud platform.
- AWS CLI: Amazon's command line tool for working with its cloud services from a terminal.
- Access denied: the service's answer when it will not let you in.
- Misconfiguration: a setting left in a state that is too open or otherwise wrong.
- Information disclosure: a problem where information that should be private can be read by outsiders.
- Bucket policy / access control list (ACL): the rules that decide who may read or write a bucket.
- Authentication: proving who you are, usually by logging in.
- API key: a secret string that lets software use a service on your behalf.
- Severity: how serious a finding is rated to be, for example critical.
- Reputation points: a score some bounty platforms give researchers for their reports.
- National ID: an official number that identifies a person in a country.
- JavaScript bundle: a file of program code that a website sends to your browser.