Of course, the second method is a lot stealthier and faster but I believe that it is a bug within Flash security model. This is the reason why I used the first method.
9110
Is flash 9 mandatory? Or can this be done for flash 7 or flash 8 also?
pdp
It has been tested on Flash9. Not sure about earlier versions! Test it and post results here! 10x.
Larry Whaley
Thank you for your work, your expertise, and your integrity. I have been working with computers for only five years, and I started late in life, I'm sixty-six years old. In 2005 hackers invaded my first computer. It is my nature to resist such action so I fought back with everything I could learn (was not enough), and everything I could buy, such as software and repair persons help. I lost eight Windows-type computers in the struggle which was fierce and lasted two years. I then gave up on Windows OS and bought an iMac, which I am now actually using. I have a great deal of information (including a hard drive) which I am considering turning over to the FBI. I would welcome advice on this proposed action. I learned a great deal from your material, and believe the hackers broke in through the gateway router, an ActionTec model from Qwest. I have a different isp now, but am afraid I am going to suffer the same fate as before since the isp controls my router, and I cannot access it at all. I have never had an email like this reach its destination; here's hoping I get through. Thanks so much, Larry
Ids Zandleven
It would be very convincing if you could offer a demo-website where the attack is successfully demonstrated. Of course in such a way that I can reset the changes in my router. I've no idea if this is realistic. Ids Zandleven
pdp
Ids, the code that I have provided is sufficient enough to test for the issue.
Oliver
I think the most worrying aspect of this exploit is the possibility that someone could alter ones DNS settings by using UPnP. With this in mind I did some digging. I checked the "Internet Gateway Device (IGD) Standardized Device Control Protocol V 1.0" at the UPnP Forum website. It appears that the UPnP specification actually consists of 13 "Service Templates". The service that controls port fowarding is called "WANIPConnection" and the service which controls LAN DNS is "LANHostConfigManagement". WANIPConnection says "The service is REQUIRED if an IP connection is used for WAN access" LANHostConfigManagement says "The LANHostConfigManagement is an OPTIONAL service". Interesting, the really dangerous service (LANHostConfigManagement) is OPTIONAL for a UPnP enabled router. Time to check mine out! Firstly I wrote a script to forward a few ports using the WANIPConnection service. After making sure my script worked, I moved on to LANHostConfigManagement. I tried several different actions, including the dangerous "SetDNSServer", and in each case my router replied "Invalid Action". From that I conclude that my router, which is a Netgear DG834, is not vulnerable to having its DNS settings altered by this exploit. It would be very interesting to know, at this point, which routers do support "SetDNSServer" in their UPnP implementation.
pdp
Oliver, very interesting and well researched. Keep in mind though that there are many UPnP options that can be altered. It might also be possible to alter the admin password and perform a CSRF or XSS attack knowing what the password would be. It also might be possible to alter the password and export the admin interface on the Internet facing side. Depending on the router model, some attacks may fail, other will definitely work.
Oliver
Thanks for your reply pdp, no doubt hackers are always looking for new exploits, good work on exposing the flaws! I looked a bit more into it and found out a way of asking a UPnP router what services it offers. Just go to: http://[router-ip]:49152/gateway.xml Where [router-ip] is the ip of your router. It should display an XML document which shows all the supported UPnP services. One can then check the UPnP specifications to see what actions can be performed. A couple of variables I just discovered are "TotalBytesSent" and "TotalBytesReceived" - could be useful for making a bandwidth monitor for routers without SNMP :-)
chiston
I was wondering, are Apple Airport Extreme basestations also vunerable to this kind of 'exploits'?
Adrian Pastor
Just noticed another domain name which the BT Home Hub responds to: bthomehub So far we got:
api.home bthomehub.home bthomehub
Adrian Pastor
@Oliver - the "http://[router-ip]:49152/gateway.xml" technique doesn't work on the BT Home Hub unfortunately.
Oliver
@Adrian It seems that the url varies from device to device. The url is actually discovered by using the SSDP protocol ( http://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol ) - which also means that you don't actually have to guess the IP of the router, because the SSDP asks each UPnP device to advertise itself and its LAN IP address. I've been investigating UPnP on my DG834 further, the most disruptive UPnP action it allows is to disconnect it from the internet. Whilst irritating, it would not pose a security threat.
pdp
Oliver, I don't want to get into more detail how this attack vector can be made ultra stable, but here are two thoughts for you:
Various router models comply to specific router names (DNS), i.e. api, api.home, home, etc.
Flashs sendToURL is executed within the context of the Flash movie and therefore can be made to submit 100 requests in a coupe of seconds.
Mike Myers
Just tested out what the UPnP services are like on the DD-WRT v24 firmware (a popular replacement firmware for the Linksys WRT54g). It implements only these services, and even then only the required functions: WANIPConnection WANPPPConnection WANCommonInterfaceConfig Layer3Forwarding The good news is that it is pretty secure: * It rejects any attempt to set a port forward to an external IP address destination. * It doesn't support the "getUserName" or "getPassword" commands, nor any way to reset or change them * It doesn't support the ability to change the DNS server * It doesn't support changing wifi settings
pdp
DD-WRT, is actually pretty good security-wise!
SG_01
Without going through all the details and comments, I did have a simple question. If I understand this correctly, the control point URL is supplied in the answer to the broadcasted request, right? So wouldn't it be perfectly possible, within the current UPnP set, so set up this control point URL to contain an encryption key? This way you could set up a dynamic URL structure such as "http://HOSTNAME/upnp/IP_SPECIFIC_PASSKEY/control_point", without having to surcomfent the UPnP protocol.
shafted
I suspect the proof of this being possible is that it seems to have happened to me - I use the bthomehub and voip phone and have been stung for hundreds of calls made using the voip number, to numbers which were called when i know no one was home and no pc was left running, thus eliminating diallers. Getting proof to convince bt is the problem.
pdp
this is very interesting and quite unfortunate. you have to investigate to see what are the damages.
ionstorm
excellent article, I have something to contribute although I am not familiar with upnp very much but I have found some interesting things with ferret on my lan: It seems all new 2WIRE Home Gateways have upnp enabled when you enable remote access to admin your router via your web browser, I have found all these files: http://ubuntu-debs.googlecode.com/files/270HG-D_Gateway_upnp_xml.tar.gz via: http://qwestcustomer-ip-address/upnp/* I have reason to believe all these companies customers are effected: http://2wire.com/index.php?p=2 While I was taking a look at these xml files it looks like people can take full control of all these 2WIRE modems which hundreds of thousands of people use, including AT&T/qwest customers. I may be completely wrong. With access to xml files with commands to change passwords and modify firewall rulesets like I have found with my own router is scary lol. Let me know what you think of these files, can someone take full control over these routers?
pdp
if UPnP is enables and it supports interesting methods such as SetDnsServer, etc then it is almost certain that someone can own them. Keep in mind though that some devices show that this method is supported although when used it is evident that it hasn't been implemented.
Ken Jackson
@pdp: "Home routers are located on 192.168.0.1, 192.168.1.1, 192.168.0.254 or 192.168.1.254 and this is the case with %99.9 if not %100 of all cases." Years ago, when I first setup my home router, I chose an IP network range that was different than any of those. I reasoned it would be more secure if I denied an attacker a default. But I never really knew of any attack that I was protecting myself from--until now. Thanks for the article.
pdp
Ken, keep also in mind that even if you choose a different IP address from the default one, your router still can be discovered by name. Most of the time it is simply called home. In the case of BT home hub it is know as api. Therefore, request to api or home will result to requests to your router no matter what the IP address is.
jimbo
Sorry but this is nothing new, it was mentioned at the last brumcon
nanard
You are right when you say that 99% of the home routers can be found by probin 192.168.0.1, 192.168.0.254, 192.168.1.1 and 192.168.1.254. But that won't give you neither the port nor the Path for the request. There is NO standard port for UPnP HTTP SOAP. (I'm not talking about SSDP). And different vendors do use differents ports (for example : 2468, 5440, 6688). Also the path is almost always different depending on the router vendor. The Linksys WRT54G (fw v2.02.7) does prefix the URL used with the device UUID. You just cannot guess that ? : /uuid:000625d7-caf9-0006-25d7-caf90232011c/WANPPPConnection:1 linksys rocks :)
Adrian 'pagvac' Pastor
@nanard: how hard is it to setup a DB of most common UPnP port number/UPnP SOAP URL combinations? Home routers can be fingerprinted using JavaScript among other methods, so this attack is trivial to mount once you have a decent database.
pdp
all you need is a database of endpoints. that's all. you don't even need to fingerprint.
josman
Hello blog very interesting. This week I found another talk about where things very interesting. Here I leave the address: http://informaniaticos.blogspot.com/
pdp
looks like an interesting read... but I cannot read Spanish, just yet.
Mancunian Bloke
This is an excellent forum. I have the following remarks to make: - I deliberately avoid getting the DNS server addresses from the router. They are configured in the PC network settings (to the OpenDNS servers). I use a very useful free security tool called Threatfire (www.threatfire.com). It allows me to set a rule to control which processes may access specified IP addresses, e.g. the router. This web site is very useful: http://cc.uoregon.edu/cnews/spring2003/upnp.html I have taken the advice dispensed within. Thank you very much. Your comments have helped me to a better understanding of the subject.
ZeroOne
The link to the Test.mxml-file does not work. Could you please fix it? Or does anyone have a copy?
pdp
It has been fixed now! We are still moving stuff around!
Matthew
Thank you--I learned from this article as well as the discussion.
Seer
Hi there... About the "discovery" problem for hackers (how to guess UUIDs and ports ?), maybe Adobe "solved" it with its freshly announced "Adobe Flash Platform for the Digital Home" ? (I think not, as I develop further on) I guess if it was available to anyone, this should provide developers APIs to read media (WebTVs) from real TVs/set-top boxes... why not from UPnP Media Servers ? Thus, things are getting easier, except if they restrain the supported requests to concern media stuff, and only it (no DNS change or port forwarding ?). Anyway the special player may not be available to anyone except device manufacturers. With flash apps not gotten from the internet but deployed in the boxes (no download, only stream play ?), no problem. I guess then that we won't be able to play free flash games from the web ;) Or only certified ones ? Keep in mind that all of it was just pure speculation and anticipation... One last word : Good discussion indeed with lots of information. I haven't studied the UPnP Security profile, but would it provide solutions ? I believe (am I wrong ?) no manufacturer has implemented it yet :)
pdp
Seer, thanks for the informative comment. I will have a look into the Adobe Flash Platform for the Digital Home which you've mentioned. Since I've been trying to hack my TV for some time now, this technology may prove to be very interesting. I am not sure if I understand your last question correctly. I believe that you are suggesting that none one is implementing UPnP in real devices at the moment. This is not true. UPnP is virtually everywhere from embedded devices to mobile phones. As I mentioned before, my brand new TV has support for UPnP and pretty much every home router I've seen is UPnP enabled.
Lee
Educational if esoteric discussion. I'm happy to say that my Netgear WGT624 does not enable UPnP by default, and I don't have a need to enable it as far as I can tell.
Timbo
Fascinating! I'm just a user of computers, neither and IT specialist nor a programmer but it seems that what you're saying is, once the hacker has obtained entry through to your network, the damage is done and turning uPnP off will be too late because the hackers are in. Is that right, or if I disable UPnP, will I be saved? Excellent article though! regards Timbo
Mexx
Can't we just hack the router without UPnP. I mean just fire queries to change DNS settings using default admin/password when 90% of the people never care to change it?
hilbert
More than two years have gone since this post and one from the last message... and I would like to know if the situation has evolved somehow. Is it still dangerous using UPnP? Did somebody try to make it more secure? Thanks for your answer,
pdp
regarding upnp, the situation is still the same although we cannot exploit it with flash through the web... not yet... some day the browser will evolve enough to allow us to do that
Bharath
I have been trying to figure how the DNS settings can be changed using the UPnP protocol. I have figured out discovering the host and also its description but I have not been able to get into the DNS settings change . Can anyone suggest a way I can proceed with it. Bharath
Omid
Can anyone tell me whether this vulnerability still exists or not? Thanks