Re:What The Rails Security Issue Means For Your Startup
by patio11 on Thursday January 31, 2013 @12:59PM
(#5146253)
Yep. localhost:3000 is only the most obvious guess you could make, too. You could try redmine:3000 and see who that worked on, or 192.168.[enumerate all IPs], or the top 1,000 host names, or use a Javascript port scanner, or... yeah, lots of bad stuff. (I thought getting into that rabbit hole would make a long and convoluted post even longer. Suffice it to say the world is a grimmer and more dangerous place than we thought it was.)
Re:What The Rails Security Issue Means For Your Startup
by rst on Thursday January 31, 2013 @02:29PM
(#5146823)
The metasploit folks put a pen-tester's guide to finding Rails-running targets on their own blog here:
https://community.rapid7.com/community/metasploit/blog/2013/...
In addition to common port numbers and stuff like redmine, their tipoffs include looking for Rails-style session cookies, and HTTP response headers emitted by Rails or support machinery. These include "X-Rack-Cache:" and the "X-Powered-By:" header that Phusion Passenger tosses in even if you've configured Apache itself to leave version numbers and component identifiers out of the response. (I'm not sure there's any better way to suppress this stuff than adding mod_headers to the Apache config and using "Header unset")
Re:What The Rails Security Issue Means For Your Startup
by WestCoastJustin on Thursday January 31, 2013 @01:44PM
(#5146542)
Note: From a sysadmin standpoint http://localhost:3000 commonly refers to http://127.0.0.1:3000. When running "rails server" locally in development mode, you actually get http://0.0.0.0:3000. These are not the same! 127.0.0.1 means that "rails server" can only be accessed from your local machine, where 0.0.0.0 means, it can be accessed on any address your computer is listening on. If you are on a local intranet, say at the office, then you probably have a 127.0.0.1 and 192.168.x.x interface, then everyone can access it via 192.168.x.x, or god forbid a public IP ;)
Re:What The Rails Security Issue Means For Your Startup
by patio11 on Thursday January 31, 2013 @01:58PM
(#5146627)
Again, even if your development box is being physically protected by the Swiss guard with a firewall that sprung from Donald Knuths' forehead with the River Styx separating it from all inbound connection attempts, it won't even matter, because you run a browser on your development box, that browser can always connect to your development box, and that browser can be instructed to pass malicious input to your development box if you do innocuous things with it like e.g. viewing web pages on the public Internet.
Re:What The Rails Security Issue Means For Your Startup
by WestCoastJustin on Thursday January 31, 2013 @02:08PM
(#5146685)
Yeah, I get it. I guess I'm making an additional point, that anyone can have direct access to the development environment via any address your machine is listing on -- not just localhost.
Re:What The Rails Security Issue Means For Your Startup
by purephase on Thursday January 31, 2013 @01:47PM
(#5146562)
Other than ease of setup, I've never understood why you wouldn't develop in the same environment as what you're running in production. Setting up a vm is trivial and allows you to easily open/close access to your application as needed.
There is also a lot less headaches once you've decided to move it into production.
Re:What The Rails Security Issue Means For Your Startup
by ZoFreX on Thursday January 31, 2013 @04:30PM
(#5147609)
Vagrant[1] is great for this :)
Re:What The Rails Security Issue Means For Your Startup
by brown9-2 on Thursday January 31, 2013 @02:20PM
(#5146774)
I don't think this would be any more secure if you were to enable networking on the VM to allow requests from the host machine, which seems like common behavior so that the developer can access the webapp running on the VM from a browser on the host. Or are people developing inside a VM and then testing with a browser on the VM?
Re:What The Rails Security Issue Means For Your Startup
by digisth on Thursday January 31, 2013 @03:19PM
(#5147162)
You can set up a cloud VM (on Rackspace for example), and then set up your VM's firewall (iptables) to only allowing connections from your test machines (could be your local IP, or the IP address of the test machines from Browserstack or Sauce.) This allows you to keep your dev/staging/prod environments in sync (and allows you to do things like blueprint/image your dev setup to build it elsewhere), decouple your dev from your staging/prod, and allow you to develop from anywhere without needing to carry around the same laptop or rebuild your dev environment on another box - particularly if you use an intermediate system with a static IP so you can reconfigure your firewall whenever needed.
Re:What The Rails Security Issue Means For Your Startup
by eli on Thursday January 31, 2013 @06:41PM
(#5148243)
I agree 100%... but doing so would not protect you from the security issue being discussed.
Re:What The Rails Security Issue Means For Your Startup
by piuk on Thursday January 31, 2013 @01:56PM
(#5146614)
Wouldn't the same origin policy prevent requests to localhost?
Re:What The Rails Security Issue Means For Your Startup
by patio11 on Thursday January 31, 2013 @02:03PM
(#5146664)
You might be thinking of preventing Javascript on host X from sending XMLHttpRequests to host Y. That will not prevent Javascript on host X from adding a form to the web page and having it post to host Y with arbitrary content, or from having an IMG tag on host X attempt to load (via a GET) a URL on host Y (assuming someone finds a pathway that works via GET requests for these or related vulnerabilities).
Re:What The Rails Security Issue Means For Your Startup
by benmmurphy on Thursday January 31, 2013 @04:34PM
(#5147628)
afaik you can't use cross site requests to exploit either the xml bug or the json bug without also exploiting a browser or plugin bug. both issues depend on setting a request header and you are not allowed to do this in the browser security model. but it sucks that CSRF bug becomes RCE bug :(
Re:What The Rails Security Issue Means For Your Startup
by homakov on Thursday January 31, 2013 @04:40PM
(#5147662)
>but it sucks that CSRF bug becomes RCE bug :(
you just said it - it cant be exploited via CSRF. Because you cannot set header.
NO EXPLOIT FOR LOCALHOST:3000 calm down
Re:What The Rails Security Issue Means For Your Startup
by benmmurphy on Thursday January 31, 2013 @05:00PM
(#5147764)
i actually lied :) there is #from_xml so if you were doing Hash.from_xml(params[:trololol]) or Post.from_xml(params[:lols]) then you would be vulnerable to localhost:3000 attack. but I don't think there is generic attack it would have to be application specific.
Re:What The Rails Security Issue Means For Your Startup
by homakov on Friday February 01, 2013 @01:10AM
(#5149494)
you still needto bypass CSRF protection which is on by default
Re:What The Rails Security Issue Means For Your Startup
by rmc on Friday February 01, 2013 @01:58PM
(#5152609)
Yet.
[1]: https://www.whitehatsec.com/assets/presentations/blackhatusa...