Slashdot Mirror


Bots Scanning GitHub To Steal Amazon EC2 Keys

New submitter juniq writes: As one developer found out, posting your Amazon keys to GitHub on accident can be a costly mistake if they are not revoked immediately.

"When I woke up the next morning, I had four emails from Amazon AWS and a missed phone call from Amazon AWS. Something about 140 servers running on my AWS account. What? How? I only had S3 keys on my GitHub and they where gone within 5 minutes! Turns out through the S3 API you can actually spin up EC2 instances, and my key had been spotted by a bot that continually searches GitHub for API keys. Amazon AWS customer support informed me this happens a lot recently; hackers have created an algorithm that searches GitHub 24 hours per day for API keys. Once it finds one it spins up max instances of EC2 servers to farm itself bitcoins."

11 of 119 comments (clear)

  1. Now where have I heard this before... by JJJJust · · Score: 5, Insightful
  2. Re:The Stupidity of Human Greed by Anonymous Coward · · Score: 2, Insightful

    How? They got $2000 worth of cpu time from amazon. If they'd waited the guy would have surely thought to change the damn API key the next morning (surely no one is dumb enough, to think just removing the stuff after the fact will help - I guess they also don't bother getting new credit cards when their wallet gets lost and returned by a nice stranger that very same day).

  3. Sounds like multiple failures by rebelwarlock · · Score: 4, Insightful

    But the user is still mostly to blame. Okay, so you might not find it intuitive that S3 keys can lead to new EC2 instances - I wouldn't have guessed that either, even though I've used both repeatedly. Maybe that shouldn't even be a possibility. But what howling insanity persuaded you to put those keys on github in the first fucking place? And if it was a mistake, why didn't you change them after? This isn't amateur hour, guys - there's real money at stake here.

    1. Re:Sounds like multiple failures by Paradise+Pete · · Score: 5, Insightful

      This isn't amateur hour, guys - there's real money at stake here.

      People make mistakes every day of their lives. We always have, we always will. It's how we learn what not to do. It's just that almost all mistakes are harmless... except on the internet. There it's like living in a minefield. Make a bad step and boom. It's not a question of amateur hour, it's a question of being human.

  4. Re:Lesson: don't use root AWS API keys by Anonymous Coward · · Score: 5, Insightful

    they could save themselves a lot of trouble by making a web UI for IAM that isn't shit, and actually documenting the system somewhere

  5. Re:The Stupidity of Human Greed by Anonymous Coward · · Score: 3, Insightful

    I assume the idea is that you make more money stealing $1 many times from more people over a year than you do trying to steal all of it from all of it at once.

    Wal-Mart!

  6. Re:Lesson: don't use root AWS API keys by Anonymous Coward · · Score: 3, Insightful

    Amazon provides extensive control over access credentials through IAM, so one can create (for example) an S3-specific user with limited privileges and generate API keys for that user. If they get compromised, the bad guy has limited access: they might be able to add new files to S3, which is bad, but it's less bad than them spinning up hundreds of servers for nefarious purposes, deleting all your files, etc.

    Agreed, but when you sign up as a new user, Amazon presents you with the root key right there. Someone signing up to test things out is likely to just copy and paste that key wherever it's needed to get off and running. I did that when I was playing with ceph, fortunately I was evaluating locally and didn't leak the key. I think a better option would be for Amazon to give you *no* API key by default, requiring you to make one with the necessary permissions and at least have a cursory look at the options.

  7. Horrible design on part of Amazon by iamacat · · Score: 4, Insightful

    When you sign up for a developer account, you should be asked how much you plan to spend per month. $2375/day would not be a common option for an individual. Given proliferation of free 15GB storage accounts, a very low end developer account with no credit card is not a crazy option. People will learn the API and use it in future, but neither them nor hackers will have enough quota to run a production site. This is just like limited data cell plans where a single buggy app can run up crazy charges. Good that they refunded money, but fundamental structural problem must be fixed.

  8. Re:I guess i am old by Kjella · · Score: 4, Insightful

    I guess i am too old to understand how loose people treat the internet these days. 'I posted my credentials openly on the internet and am now shocked that I have been taken advatage of'... no way! You shared the keys to your kingdom and someone abused it?? Shocking.

    He wasn't surprised they were abused. He's surprised what he thought was keys to S3 unlocks the entire kingdom. Like you lose a card for electronic bus tickets and you think the worst they can do is ride the bus for free. Except the card doubles as a "secure ID" and they order thousands of dollars worth of goods from cooperating merchants, which you didn't even know was possible. Sure posting them on Github was ignorant and entirely his fault, but if you try to assess the risk then it's probability * impact and I think he just got a big surprise when it came to impact. I think you're being too hard on him.

    --
    Live today, because you never know what tomorrow brings
  9. Re:The Stupidity of Human Greed by tlhIngan · · Score: 4, Insightful

    I assume the idea is that you make more money stealing $1 many times from more people over a year than you do trying to steal all of it from all of it at once.

    It works in real life all the time, actually - companies do this quite routinely. Jack up your bill by $2 and they can rack up millions over the year, and it doesn't matter if it's a contract or not because how much are you going to spend trying to recovery $24/year? If it's a cellphone contract, the max they're going charge you is $48 more over the contract's 2 year lifespan. You going to sue them over that? Now repeat that for a million subscribers and that's an extra $2M a month in free profits.

    Maybe you can jack it up by $5 ($60/year) because it's still too low to bother.

    It's why they made class-action lawsuits, because someone stealing $48M/year would get sued/arrested/etc if it was against one person, but against 1M people? Worthless.

    As for this, well, given it's still "free money", even at Bitcoin's deflated value of around $350 or so, it's still free money. Who cares about efficiency or anything when you can steal CPU cycles like that - just scan github checkins for the key, then use the APIs to automatically create sessions and all that and rack up the bitcoins. Even the github scanner doesn't have to be owned by the user - they probably stole some guy's EC2 credential and are using one of his instances for it unbeknownst to the user. Free money!

  10. Give the man some slack by hankwang · · Score: 4, Insightful
    To all posters who are blaming the man for being so stupid: please RTFA. He had just opened an amazon AWS 1-year free trial to practice what he'd just learnt about Ruby on Rails. He made a mistake:

    I knew my API key needed to be safe, so I installed the Figaro gem (a rails API key security gem, which typically works great), and trusted it to keep my API key off of git when I pushed. (...) deleted all traces from GitHub. I was able to clean it up within about 5 minutes (...) After a close call, I went to bed.

    Surely it is not that unreasonable to (1) realize that those keys will be scraped within 5 minutes after uploading to an obscure project, and (2) not realize that an S3 key in a free trial subscription wouldn't allow racking up $2375 in EC charges within 10 hours?