25 points · by hasangursoy · 4y ago · 44 comments
In the project, I was reading my private keys from a json file and last night I accidentally committed this json file to my GitHub private repository. The repository was brand new and I just emailed an invitation to my colleague that we were working together on Zoom. After realizing that I have committed the private keys, I immediately deleted the whole repository and pushed a whole new repo again.
But after 1 hour, I discovered that nothing was left in my wallets and whatever I sent to these wallets is being transferred to another account afterwards.
Here is an example of transactions from the last night:
https://polygonscan.com/address/0x7a9eb3cc39bc6ac940febbdb5bb29b8f9ece8a5b
All of the sender wallets were mine for the recipient above.
What do you think?
(Information security is hard and you only have to make a mistake once.)
Sure, but using any third party is inviting a layer of risk. Banks get hacked too. No system is without vulnerabilities. You decide which to trust, including your potentially error-prone self.
Did you check your security log in github?
Do you have MFA enabled on your account?
Did you check your repository and account and make sure that all of the SSH keys saved are recognized and known to you?
Did you refresh all of your keys and make new ones?
You need to start at the beginning.. starting with the theft transactions is starting at the end.
----
Long story short, there is no way to tell you what happened without you investigating first.
It could be you just not MFAing your account and re-using passwords.. and someone logged into your github account and added their own private keys.
Really it could be a million different scenarios, but whatever happened, you need to investigate first.
I am pretty sure that no security flaws was the cause of this, except pushing to the private repo.
I have checked the transaction and the commit dates, which are matching perfectly. No doubt about that.
With that said, they stole 7 dollars. Pretty cheap lesson on security in my opinion.
There are many people writing automated tools doing their best to catch slip-ups like this before everyone else. Dark Forest and all that.
And as someone else said, why use a wallet holding mainnet private funds as a dev wallet? Separate your keys.
And these scripts can see my private GitHub repositories? If so, what's the difference between public and private repositories?
Is this a failure of GitHub's security?
Or perhaps you unknowingly uploaded the file to another repo as well?
Others in the thread mentioned that they have private keys in their repo as a honeypot - if there was a security breach within GitHub, their keys would also be lost.
What would be a horrifying scenario would be to lose those affordances and backstops for new technology that requires humans to not make mistakes to operate it safely
Most likely explanation is that if you didn't drain the wallet yourself then the only other person with access to your private key did.
The first one that comes to my mind is shhgit (https://github.com/eth0izzle/shhgit)
Anyone can self host it and then add multiple GitHub Dev keys to it. Then this can be used to monitor GitHub commits being done, majority of which can be categorized as "secrets".
Did you try asking your buddy to give back your coins lol
Always roleplay as your favorite neutral characters and don’t trust anyone when dealing with crypto! Trustless
Sorry that happened to you, I hope it wasn't a lot of money.
Considered adding files like that to .gitignore in the future.
So far, nothing has been taken from GitHub.
(It's part of research for my side project serverthiefbait.com)
Seems like you could achieve the same result if you just let your customers buy their own coins and provide an address for you to watch?
Look up documentation and examples on .env files.
If you deploy to a service such as Vercel or AWS you can set environment variables there for production.
Trace back as you might have overlooked something. Start from the beginning.
I could see an extension watching for git like listings with json files named like wallets and fetch()ing them when they appear.
Easy enough to recreate, test with the devtools tab open.