How I hacked a gmail account
A developer found Gmail credentials committed to public GitHub repositories. By trying one set of credentials, they were able to log into the corresponding Gmail account after passing a phone verification step.
medium.com
Published on medium.com
I have never considered myself as either a hacker or security expert, however, I managed to get into a Gmail that wasn’t mine. It all started because I was looking for a way to send emails using python.
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely developers hardcoded Gmail credentials in source code and committed them to public repositories.
Impact
An attacker could gain access to Gmail accounts whose credentials were exposed in public repositories, though in this case the account appeared to be a dummy test account.
What the attacker needed
Credentials exposed in a public repository; access to the repository search
The fix
Developers should never commit passwords to public repositories and should use environment variables instead.
How it was found
- Search GitHub for code containing Gmail SMTP connection strings.
- Identify repositories that include email addresses and passwords.
- Take one email/password pair and attempt to log in to Gmail.
- Complete the phone verification step when prompted.
- Successfully access the Gmail account.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
People sometimes save passwords directly in their code and upload that code to public websites like GitHub. Anyone can then search for those passwords and use them to log into the accounts they belong to. This is dangerous because it gives strangers access to private accounts.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.