TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Hacked: commit to rails master on GitHub

655 pointsby stweabout 13 years ago

29 comments

wycatsabout 13 years ago
Here's my proposal for improving the situation: <a href="https://gist.github.com/1974187" rel="nofollow">https://gist.github.com/1974187</a><p>Merb's approach was to have mass assignment protection in the controller, and I personally think it's self-evident that it belongs there. Moving it into the controller will also make it easier to solve the tension between reducing the friction of getting up and running quickly and having good security defaults.<p>In general, Rails' convention over configuration make a stock Rails app more secure by default (CSRF protections, XSS protection, timing attacks, session fixation, etc.). This is a case where there's a real tension, but I think that we can solve it by applying some brainpower to the question.
评论 #3663718 未加载
评论 #3663740 未加载
评论 #3663706 未加载
评论 #3664830 未加载
评论 #3663630 未加载
评论 #3663694 未加载
评论 #3663405 未加载
评论 #3663804 未加载
teejabout 13 years ago
Posting it as an issue on the Rails repo and then exploiting GitHub with it is a great way to get attention, but not necessarily the most responsible.<p>I disclosed a vulnerability to GitHub before. I dropped it into their Issues system marked private with the heading "URGENT". It was a Sunday and I got a response + a fix from Tom Preston-Wener himself within a few hours. That, in my mind, would have been a more responsible approach.
评论 #3663847 未加载
评论 #3664044 未加载
评论 #3663825 未加载
评论 #3663956 未加载
评论 #3666703 未加载
danmaz74about 13 years ago
I would say that homakov's angry and not very mature reaction to his warning being ignored just did a very big favor to a lot of rails developers, that reading about his exploit on HN (and other places) will rush to check their websites and will fix a LOT of serious vulnerabilities they didn't have any idea they had. But which somobody could have already been secretly exploiting.<p>Understandably, Github would have liked much more to be one of those companies that will be able to quietly fix this vulnerability without anybody knowing, but now that the damage to their image is done I really hope they'll not add to that damage by persisting in their banning of a 18 year old that acted irresponsibly yes, but maliciously - definitely not.<p>From a PR perspective, I guess that having titles like "Silicon Valley company rewards Russian teenager who helps them eliminating a security risk" could even spin the episode in their favor.
评论 #3664412 未加载
shearn89about 13 years ago
This is clearly a problem: with Rails' approach being 'right from the start', having no protection by default is not the right way to do it. This issue may be well known among the type of people that use github and read HN, but if someone had read about Rails being an awesome framework to make db-driven websites, they might not be aware of such a thing as a "mass assignment vulnerability."<p>If by adding a line or 2 to the code for generators can stop this, even if it includes a comment saying "Removing this line will do x y z", then I think the rails team could've treated the bug with a little more respect.<p>As @ericb said, if strong devs make this mistake, there's something wrong with the code.<p>I think it should also be noted that he didn't do anything malicious like trash repos, and even says on his blog:<p><pre><code> "Then I could wipe any post in any project. That wasn't that funny but pretty dangereous[sic]. It got more curious." </code></pre> All he did was add a 3 line file to the master repo of a project that he was frustrated with. It generated all this attention, and will probably make them rethink the approach...<p>Finally: big props to the GitHub team for patching their vulnerability in &#60;1hr on a Sunday...
holmanabout 13 years ago
We've patched and fixed this on GitHub.
评论 #3663454 未加载
评论 #3663912 未加载
评论 #3663395 未加载
评论 #3663339 未加载
评论 #3663345 未加载
评论 #3663584 未加载
评论 #3663499 未加载
bretthopperabout 13 years ago
Everyone might as well take this opportunity to add attr_accessible to your models.<p>Models: find app/models -type f -name \*.rb | wc -l<p>Models with attr_accessible: grep -r -m1 "attr_accessible" app/models | wc -l<p>If those numbers aren't the same, and the missing model files inherit from ActiveRecord::Base, then look into adding attr_accessible.
评论 #3663981 未加载
评论 #3664322 未加载
mojomboabout 13 years ago
I have written a blog post outlining the exploit and our mitigation procedure: <a href="https://github.com/blog/1068-public-key-security-vulnerability-and-mitigation" rel="nofollow">https://github.com/blog/1068-public-key-security-vulnerabili...</a>
评论 #3664806 未加载
评论 #3664864 未加载
sad_pandaabout 13 years ago
This is a pretty huge security issue with wide-reaching implications. People everywhere pull and compile from master branches on Github without second thoughts. It's a big hole. But everybody's running defense for GitHub.<p>Contrast this with the enormous hue and cry against FB, MS, et al. when they have comparatively minor holes in their systems.<p>I'm not saying that we need to tar and feather GH, but we should at least be equal-opportunity in our condemnations and realize that everybody is capable of mistakes. So, if you're OUTRAGED about Apple making a minor boo-boo, you should be equally outraged about this.
teycabout 13 years ago
I love the delicious irony when all sorts of rails dev argue for status quo only to find their master hacked because the source control system has the same vulnerability.
patrickaljordabout 13 years ago
Funnily, the first Diaspora release had the same issue and the devs were ridiculed and called noobs by a big part of the HN community and security "experts" wrote big posts about it. The different reaction here is interesting to say the least.
评论 #3663580 未加载
评论 #3664117 未加载
评论 #3664637 未加载
评论 #3664368 未加载
hundredwattabout 13 years ago
I threw together a quick 'n dirty Rails generator that will generate the code for white/black listing all model attributes with attr_accessible/attr_protected.<p>Here's the file: <a href="https://gist.github.com/1975167" rel="nofollow">https://gist.github.com/1975167</a>, just add to lib/generators in your Rails 3 app, then do rails g mass_assignment_security -h<p>Hopefully others find this helpful
wandernotlostabout 13 years ago
This is basic security, folks: never drive your application from stuff that comes over the wire (or any untrusted channel). Passing a params array directly to update_attributes is a fundamentally flawed approach for this reason. Instead, inspect incoming data for exactly what you expect to be there. By doing this, malformed input will either fail or be ignored without exposing a security vulnerability.<p>It should be obvious that you can't anticipate every potential attack vector at design time. Therefore, a well-designed system is one for which, when expected or normal conditions are not met, the resulting action is nothing or error, not an unexpected action.<p>This principle is also known as fail-safe: <a href="http://en.wikipedia.org/wiki/Fail-safe" rel="nofollow">http://en.wikipedia.org/wiki/Fail-safe</a>
arturadibabout 13 years ago
I'm confused. Is this a generic Github vulnerability or is this a vulnerability in tools outside of Github used by Rails? The 'hacker' seems to suggest it's the former ("Github pwned"), which would be pretty serious stuff.
评论 #3663302 未加载
评论 #3663256 未加载
评论 #3663261 未加载
评论 #3663266 未加载
评论 #3663281 未加载
评论 #3663255 未加载
评论 #3663260 未加载
codesuelaabout 13 years ago
I don't get how many of you seem to take this issue lightly. Imagine what would've happened if this guy was a black hat. I use github for private code hosting and this a definite breach of trust and if I don't trust github how can I pay them? Sure they fixed the issue within an hour but still this could have ended far worse.
Estragonabout 13 years ago
So, the vulnerability was public for at least days in homakov's bug report, and probably for years to anyone who wanted a crack at github badly enough to do a little research. Is it paranoid to worry about malicious commits in other important github repositories?
nateabout 13 years ago
Shouldn't rails by default protect belongs_to associations. There is probably a minute number of cases where someone wants mass assignment changes to include the parent's id of that record.
评论 #3663853 未加载
raggiabout 13 years ago
<a href="http://speakerdeck.com/u/holman/p/ruby-patterns-from-githubs-codebase?slide=33" rel="nofollow">http://speakerdeck.com/u/holman/p/ruby-patterns-from-githubs...</a><p>nuff said.
bbeausejabout 13 years ago
How can you be sure Homakov is the first person to notice GH was vulnerable if the vulnerability was present for many years in the codebase?
tloganabout 13 years ago
Can somebody explain why this is a Rails bug?<p>Meaning using mass assignment is very similar to SQL injection: you pass variables from user input directly to model without even verifying them. Duh?<p>Now regarding GitHub: yes there is a security hole and they fixed it.<p>However, hacking a site after finding its vulnerability is definitely illegal and hope there will be consequences. And he did not even report a problem to GitHub.
评论 #3664841 未加载
tvonabout 13 years ago
Nothing makes you look like more of a jackass then throwing gifs into rails commit comments.
deanpcmadabout 13 years ago
How has he hacked Github? He's a contributor on rails/rails see here and search for homakov - <a href="https://github.com/rails/rails/contributors" rel="nofollow">https://github.com/rails/rails/contributors</a>
评论 #3664453 未加载
评论 #3664533 未加载
comechaoabout 13 years ago
He did the same with Tower: <a href="https://github.com/rails/rails/commit/b83965785db1eec019edf1fc272b1aa393e6dc57" rel="nofollow">https://github.com/rails/rails/commit/b83965785db1eec019edf1...</a>
orblivionabout 13 years ago
&#62; "Since you can commit to master, you could just fix the vulnerability :) "<p>I like it, this would be a great way to be snarky and semi-responsible at the same time.
评论 #3664801 未加载
mvasilkovabout 13 years ago
IMO this attitude of GitHub is the best motivation to sell 0day exploits in private instead of ever trying to get dev's attention.<p>No, I mean really, "malicious attack". I can't help but laugh, he committed 3 lines of text grand total, this is what you call malicious? Seriously, WTF.<p>The guy is a proper white-hat hacker, even if somewhat childish, Y U ban him.
zyfoabout 13 years ago
Here's the guy's blog post about the hack: <a href="http://homakov.blogspot.com/2012/03/egor-stop-hacking-gh.html" rel="nofollow">http://homakov.blogspot.com/2012/03/egor-stop-hacking-gh.htm...</a><p><i>"Today I can pull/commit/push in any repository on github. Jack pot."</i>
评论 #3663324 未加载
javascriptlolabout 13 years ago
Even a genius eventually makes a mistake. Systems should be safe by default unless there's a good reason (e.g. performance). Why bother with high level tools if they're not even protecting you from mistakes?
shearn89about 13 years ago
Also just noticed this at the bottom of his resume (<a href="http://homakov.blogspot.com/p/service.html" rel="nofollow">http://homakov.blogspot.com/p/service.html</a>):<p><pre><code> "&#60;s&#62;Discount for girls&#60;/s&#62;"</code></pre>
aplabout 13 years ago
It's unfortunate that the guy stumbling upon this apparently noteworthy vulnerability happens to be so utterly <i>immature</i>. [EDIT: Unsurprisingly, the dude's 18. See <a href="http://homakov.blogspot.com/p/about-me.html" rel="nofollow">http://homakov.blogspot.com/p/about-me.html</a> for reference.]
评论 #3663316 未加载
评论 #3663288 未加载
评论 #3663328 未加载
klodolphabout 13 years ago
If this is a GitHub exploit, and I were GitHub, I would be talking to law enforcement. This is not how adults disclose software vulnerabilities.
评论 #3663325 未加载
评论 #3663268 未加载
评论 #3663279 未加载
评论 #3663292 未加载
评论 #3663350 未加载
评论 #3663331 未加载
评论 #3663515 未加载
评论 #3663271 未加载
评论 #3663946 未加载
评论 #3663309 未加载