13 ms·
NAT Slipstreaming
- CraftThatBlock 6y agoHug of death? Can't find any cached versions either.
- nyx_ 6y agoYou can read the post at https://github.com/samyk/slipstream https://github.com/samyk/slipstream
- deleted 6y ago[deleted]
- jimnotgym 6y agoThe title would be easier to understand as NAT, rather than Nat.
- m463 6y agoInitially I thought it was a person.
- codetrotter 6y agoMight be HN title filtering that did it? I think I’ve seen it downcase uppercase words before. Or OP could be on mobile and their phone did it. It’s anyone’s guess.
- m463 6y agocool - they fixed it
- deleted 6y ago[deleted]
- girst 6y agowow, that's as simple as it is genius. the core of the hack is the realisation that one can generate arbitrary tcp or udp packets from a browser by exploiting ip packet fragmentation (embed the evil packet in a large http post request that gets fragmented at just the right place). and worst of all: i don't see a quick way to mitigate this. afaict, router firmware will need to be updated to check the fragment offset, right?
- Lammy 6y agoAm I safe with "scrub in all fragment reassemble" in my PF config on my router box?
- PhantomGremlin 6y agoWhich OS are you running with PF? On OpenBSD, PF will reassemble fragmented packets by default. Your question still stands, is this sufficient to prevent this attack? Perhaps someone who has a greater understanding of PF and of this exploit can respond.
- _-___________-_ 6y agoPF doesn't implement any ALGs by default. To my knowledge, it doesn't even have any ALG capability. So, this type of attack would not work through a NAT implemented by PF unless you have separately added an ALG via hooks (like ftpsesame).
- chc4 6y agoBrowsers can add the SIP port (5060) to the restricted ports blacklist.
- _-___________-_ 6y agoPreventing one specific implementation of the attack concept without actually solving the problem.
- viraptor 6y ago> i don't see a quick way to mitigate this Go to your router's panel and disable sip support / alg. Even if you use sip, it's still going to work. (Apart from some really weird edge case network setups)
- zamadatix 6y agoChecking the fragment offset is the right way to run the ALG but the router really shouldn't be running a SIP ALG by default either. Not only do most home users not use SIP but most SIP users don't need the ALG. Browsers could also block the ports but that's a hack to work around the issue not a proper fix.
- formerly_proven 6y agoIf you see samy.pl, you know it's going to be good. So this effectively means that you can't bind anything any more on a machine that maybe runs a web browser.
- deleted 6y ago[deleted]
- t0astbread 6y agoAnd that you should block connections to your local network from websites.
- wbl 6y agoIf you use a firewall that still works. The issue is treating NAT as access control.
- twic 6y agoThis is very cool, but it seems like it requires an egregious router bug. Why would a router consider a packet to be a legitimate SIP REGISTER when it occurs as part of a TCP connection which has already carried an HTTP header? Is the story here that ALG is a crude hack, which works by naively looking at each packet, without trying to parse the whole stream, and so is vulnerable to this kind of confusion? If so, there are presumably endless varieties of ways to fool it.
- viraptor 6y agoI'm not sure how much has changed in the last 10 years, but when I did lots of VoIP work then, the consensus in many places was "every ALG is broken, start by disabling ALG". SIP is complicated in unexpected places and even with the best intentions ALGs broke packets by rewriting wrong parts or making header formats invalid. But specifically regarding your question, sip looks like http. Same structure / similar response codes. They probably didn't want to write a very strict sip-detector and ended up checking "looks like a verb+destination+ headers? Good enough". Or maybe it's to support http proxies where a http CONNECT session can turn into sip-tcp? (Never seen that in practice, but I guess it's possible) Or maybe it's just that the alg processing is per-packet, not per-session? Who knows. Just login to your router and turn off ALG. Your SIP phone most likely already knows how to deal with NAT using stun/turn.
- chc4 6y agoIt's not smuggling a SIP session request via HTTP headers - even if it didn't look anything like HTTP it would be vulnerable to this attack, because the controlled fragment is arbitrary binary data from their POST body. The problem is the router's firmware doing detection on each packet without checking that the fragment offset is 0 first.
- viraptor 6y agoI didn't say it relies on http headers. Just made a guess on what alg may be doing. Yeah - it's broken with fragmentation, and possibly in other ways too.
- foota 6y agoReminds me of a similar attack where http handling was used to poison intermediate caches. Will try to find the name. Edit: I think I was thinking of http request smuggling, although I seem to recall something slightly different.
- _qulr 6y ago"hidden img tags to all common gateways (eg 192.168.0.1) are loaded in background onerror/onsuccess events attached to img tags" It has always been a big mistake for browsers to allow internet pages to make requests to LAN IPs. This has been exploited before: https://www.forcepoint.com/sites/default/files/resources/files/report-attacking-internal-network-en_0.pdf https://www.forcepoint.com/sites/default/files/resources/fil...
- anaphor 6y agoThe mistake is web applications that rely on session cookies alone to authenticate requests. Of course it's not their fault that it's so difficult to secure web apps, but by now this is common knowledge (CSRF/Confused Deputy Attacks). Not allowing browsers to make requests to internal IPs would break many things. We should be moving towards an internet architecture where there is no such distinction anyway.
- viraptor 6y agoThere's still lots of use cases for internet to local communication. Not everything lives in the cloud completely and there will be services which legitimately need to get data from your internal endpoints.
- pseudalopex 6y agoBrowsers use prompts for less dangerous things.
- kortilla 6y agoThere is nothing special here about LAN IPs. This same problem impacts anything that sits behind a firewall that the browser might have access to. A browser has no way to know that a particular IP address is supposed to be sacred and unreachable by other websites. I’ve seen several dashboards hosted externally that load things from internal IP addresses and that design is MEH but it works.
- jeremyjh 6y ago
- DenseComet 6y agoPeople argue against IPv6 because they claim that NAT provides some security, even if its just another layer by obscurity. The argument was already pretty shaky, but with attacks like this, it's pretty evident that firewalls provides security, not NAT.
- saurik 6y ago(The competent argument is that NATs provide privacy, not security.)
- etaioinshrdlu 6y agoAgreed... I don't know why I get basically attacked online whenever I suggest that IPv4 with NAT offers typical internet users more privacy than IPv6, even with IPv6 privacy addresses.
- darren_ 6y agoCan you explain what privacy you think it offers over IPv6+privacy addresses? As far as I can see it offers that activities behind the NAT get grouped behind one IP to the outside world, and I guess harder host discovery. Is there more?
- etaioinshrdlu 6y agoNo, I think that's about it. But that is quite significant. It means that an IPv6 address uniquely identifies one computer (albeit temporarily). An IPv4 with NAT does not identify one user, it might be anywhere from 1 to thousands. A possible solution I'd like to see explored is to have each new web browser tab (and every process on your PC more generally) use a unique, fresh public IPv6 address by default. One would only use a semi-static IP if running some type of server.
- saurik 6y agoAs those unique "fresh" addresses would have to come from some shared routable prefix (which is the core problem with the various IPv6 randomized address solutions), that would still provide strictly worse privacy than NAT: if you happened to be one machine before you are now outing to the world the connection correlations between your tabs, and if you were multiple machines before you are now separating the traffic from the multiple users; meanwhile, no one thinks you are a large number of unrelated addresses (as no one is dumb enough to be tricked by your supposedly-separate addresses that all share the same prefix). FWIW, one can totally implement NAT for IPv6, and in fact people have: everyone should always use NAT. NAT is the correct solution to this problem, whether you are mixing your traffic locally on your own network or are shifting your traffic through remote mixers (which is effectively what Orchid--the open source decentralized privacy network I work on, funded by some major VCs--does, though it frankly isn't there yet with "#privacy" despite having launched a long time ago and being usable today; btw: I haven't finished implementing this yet, but "use a separate circuit for each target host", which I think best achieves your dream of an address per tab, is one of the features I have been intending to have in Orchid for forever ;P). (It makes sense for me to attach this to this comment, but I appreciate I am likely preaching the choir with respect to responding to you ;P.) The downsides people like to whine about for NAT involving peer-to-peer connections and hole punching are either misunderstandings (people often like to claim things don't work that do), are caused by shitty NAT implementations (that ignore the RFC recommendations on NAT), or were fixed by PCP/NAT-PMP (which is the technology everyone should be implementing support for in their software stacks, not IPv6). (With respect to the attack in this article, this isn't an attack on NAT per se: it is an attack on these "application level gateways", which I frankly had always assumed were a "crazy" Linux IPMASQ feature, not something people were using in production. I appreciate why people are doing this: no one integrates PCP/NAT-PMP, and there exist older notably unencrypted and thereby already somewhat unfortunate protocols--such as FTP and SIP--that have port allocation assumptions that the router is trying to fix with heuristics. This mechanism doesn't work if the traffic is encrypted anyway--and all of these protocols support encryption as of 15 years ago, and a lot of users actually did switch--so I will claim these features should not be deployed: developers should use PCP/NAT-PMP in their clients or we should potentially integrate it into their operating systems, and not pretend that ALGs are much more than a dangerous MITM attack.)
- Thaxll 6y agoAnother reason why you should run things on localhost and not 0.0.0.0 even for local testing.
- cjbprime 6y agoThat's actually not secure either, for a different reason -- DNS Rebinding exposes localhost-only servers to the outside world through your web browser. See e.g. https://bugs.chromium.org/p/project-zero/issues/detail?id=1471&desc=2 https://bugs.chromium.org/p/project-zero/issues/detail?id=14...
- theamk 6y agoThis attack is pretty old. Are the browsers still vulnerable to it? I could not find any definite information, but Firefox has a bug [0] which starts from: > Browsers implement their own dns cache to prevent an attack known as dns rebinding. [0] https://bugzilla.mozilla.org/show_bug.cgi?id=689835 https://bugzilla.mozilla.org/show_bug.cgi?id=689835
- cjbprime 6y agoYes. You can see that this bug was marked wontfix. Ultimately, it seems that browsers have decided that breaking DNS rebinding breaks an unacceptable number of legitimate use cases. You can still fix it at your own router/DNS server, though.
- phendrenad2 6y agoPage behaves very oddly on mobile. If you scroll to the right to see the animation, it gets stuck and won't scroll back.
- phendrenad2 6y agoGotta love that everyone has a high-powered low-quality Linux box with zero security auditing handling all of their internet traffic!
- _-___________-_ 6y agoIf it was just a Linux box, they'd probably be much better off. It's all the crap that vendors add that usually causes problems. Most people building their own iptables firewall would not enable any ALGs, since they're almost always the worst way to solve NAT problems. OTOH, vendors want everything to work out of the box as much as possible, even in weird edge cases with broken servers/clients, so they enable all available ALGs and sometimes don't even provide a way to turn them off.
- justinlloyd 6y agoI understand _how_ the attack would work, but I do not know if the linked page is supposed to be a proof-of-concept of the attack, or where I would click on the cited web page to demonstrate the attack on my machine. What am I missing? Unpatched Windows 10 (17134 1098) running an ancient Chrome 67.
- peteretep 6y agohttps://samy.pl/slipstream/server https://samy.pl/slipstream/server
- cjbprime 6y agoThis looks neat, but it seems like DNS Rebinding is likely more powerful here -- that would get you access to servers on the entire local network (not just the victim's own machine) without having to know the local browser's own IP first, so both the exploitation potential and the ease of carrying out the attack seem better for DNS Rebinding to me. Also, DNS Rebinding exposes services which are only listening on local interfaces (127.0.0.1) and I suppose this wouldn't. Could someone help me understand some common circumstances in which using NAT Slipstreaming would be a better choice?
- tprynn 6y agoWith DNS rebinding, you can still only send HTTP requests* to the target. With this attack, you have a direct, raw TCP/UDP socket. (*) I'm simplifying, what I mean is that DNS rebinding still limits you to only what you can do in the browser, which is effectively HTTP. Most non-HTTP services will generally just close your socket once they see you send an HTTP request.
- cjbprime 6y agoThanks. So the most likely scenario where it's worth the extra effort here would be to contact a non-HTTP TCP service on the victim's machine.
- shawnk 6y agoDoes this mean I can become a hacker???
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]
- _-___________-_ 6y agoI've always been really suspicious of ALGs, and disable them whenever possible (or simply don't use them in the first place when setting up my own iptables firewall etc). They are generally somewhat neglected, and fairly complex, and they try to understand the flow of a protocol without really implementing the protocol, making them ripe for confusion-type attacks.
- marcan_42 6y agoIf you rely on ALG, you are using plaintext protocols and you have bigger security problems. ALG does not work with TLS. ALG was always a horrible hack, and has been pretty much obsolete for the past 10 years. Just turn it off.
- deanclatworthy 6y ago> animation generated with my fork of draw.io, allowing exportable edge context flow & control in animations I didn't even know you could draw isometric diagrams with draw.io - any more info on this?
- zupa-hu 6y agoJust heard of draw.io for the first time. The product seems extremely polished. And it's free. And it's open source. And they have a non-trivial team. And they don't force you to sign up. And they make money. (I understand as a paid addon in Atlassian.) I'm buffled. Very interesting.
- draugadrotten 6y ago...and they are competitively priced for Atlassian as well. We migrated away from Gliffy to draw.io on price alone. If Gliffy's pricing had been near draw.io, we would have stayed, but it was >2x higher.
- ship_it 6y agoIt might be a feature implemented by Samys fork although no implication of that is visible.
- lf-non 6y agoJust search for isometric in the search box in the sidebar. They have a isometric edge/cube/square available there. Also, when you are creating a new diagram, they have a couple of examples in the cloud section.
- PragmaticPulp 6y agoHas anyone been able to reproduce this? Or find a report from someone who could? The exploit depends on the user’s router having enabled a broken ALG implementation that ignores the fragment offset. I’m sure there are routers in the wild with this bug, but so far I haven’t been able to find any reports of the POC exploit working for anyone who tried it (before it was disabled). The POC shows a message about ALG not being enabled when it fails. Samy says he used a Netgear R7000. Would be interesting to get some POC test results from other routers.
- arpa 6y agoIt's a router released in 2013 and uses kernel from 2011. I wonder how modern alternative / opensource firmware would compare.
- Dahoon 6y agoWell, for one OpenWRT is on kernel 5.4.
- new23d 6y agoIf one were to calculate the CVSS score or such for this, it would be pretty low.
- gnfargbl 6y agoThe attack relies on the ALG ignoring the IP fragment offset in the UDP case only. In the TCP case, he's splitting up packets by forcing a smaller MSS rather than by relying on IP fragmentation. The IP fragment offset for the attack packet, in the TCP case, will be zero as usual. To detect the attack in the TCP case, the ALG would have to keep a stateful record of the initial sequence number on the outgoing SYN, and to accept the SIP REGISTER packet iff seq# == ISN+1. Because home router firmware is invariably written by the lowest bidder, I would be surprised if very many firmwares actually do that.
- arpa 6y agoWhat stood out for me was the kernel version of netgear equipment used: 2.6.36.4 That is a kernel nearly 10 years old. Of course, the router itself was released 7 years ago... and of course vendor stopped updating fimware as soon as they could... and of course it's still in production and for sale... and of course it costs $150+. It's a good thing dd-wrt and similar exist.
- ATsch 6y agoThe bigger problem with these is usually not the vendor of the router, but the vendor of the SoC the device is built on. SoC vendors will usually provide you with a linux kernel that has an incredible amount of frequently shoddy out of tree patches and tweaks which make it very hard to rebase to a new version even if you really wanted to.
- arpa 6y agoThat is also true.
- steeve 6y agoExactly this. This situation is the same with SBCs. A product having a mainline kernel is a huge plus.
- ksec 6y agoI remember IBM donated ( or released ) an OpenPOWER 14nm CPU design ( with 7nm design coming in a few years time ). I wonder how far are we from having CoreBoot, mostly opened hardware Router and Appliances.
- iforgotpassword 6y agoBut then why should I prefer Netgear over some Chinese no-name device that costs a fraction and does exactly the same while also never getting updates? Where does that extra money go to? But like op said, nowadays I just check OpenWRT compatibility when it comes to buying a home router, a well supported device usually receives updates for a good decade. (Anecdotally I've had three Netgear devices in my life and all of them caused severe problems. Enough for me to have them on my personal blacklist for life.)
- bestboy 6y agoI'd suggest to disable webRTC and webGL (unrelated to this particular issue but still) in the browser for fingerprinting reasons alone. e.g. firefox > about:config: * media.peerconnection.enabled false * webgl.disabled true
- Kiro 6y agoHow do play WebGL games? Do you temporarily activate WebGL or can you whitelist sites?
- bestboy 6y agoI do not play 3D games in the browser. If that is a usecase, then webGL has to be enabled of curse. If browser games were a usecase of mine, then I'd keep my safe "daily driver" Firefox for surfing the WWW with the mentioned restrictions in place. I'd use a separate Chrome browser as a "game client".
- Tepix 6y agoVery impressive combination of tons of little quirks and deep knowledge of TCP/IP. Well done!
- punnerud 6y agoThe save post together with code on GitHub: https://github.com/samyk/slipstream https://github.com/samyk/slipstream
- revanx_ 6y agohidden img tags to all common gateways (eg 192.168.0.1) are loaded in background And why would browsers allow this? If I connect to external IP address, why would the browser happly parse such html tags that allows introspection of my local network? Unless of same origin, browsers should not allow this, seems like a bug.
- ship_it 6y agoFrom an Infosec perspective, this is normal. CORS should be put on place per local network visibility or host to disallow such feature.
- revanx_ 6y agoI thought CORS is blocked by default in modern browsers?
- 19870213 6y agoCORS is only applied to javascript, not GET requests via img, link or other tags that load resources.
- wongarsu 6y agoIt is, but it's a bit leaky simply because it's such a late addition. Img tags aren't subject to CORS (you can display images from anywhere). Access to the loaded image data is CORS controlled, but the onload and onerror handlers or the dimensions of the final img tag aren't restricted. If you know for example the path of the netgear logo on a router, you can try loading it and determine success/failure. Existing CORS isn't strict enough to prevent this, and it's debatable whether it should be
- intricatedetail 6y agoWhat are the arguments against?
- 6y ago
- huhtenberg 6y agoThis is a truly marvelous piece of work. Expected nothing less seeing who it was from. However, don't miss that it all works because Netfilter passes IP fragments to the ALG instead of either reassembling packets first or making the ALG fragment-aware. Either way it's a software bug, rather than an inherent flaw of the protocol stack.
- gnfargbl 6y agoThere are two different mechanisms of interest here: IP fragmentation (IP packets get broken up into smaller chunks, because intermediate networks have an MTU which is too large to allow them to pass) and TCP segmentation (the TCP stack breaks up payloads into segments no bigger than the requested MSS). The author here presents two variants of the attack. The UDP variant does indeed rely on IP fragmentation, but the TCP version does not. To mitigate the TCP version, the ALG needs to be aware of the state of the TCP connection. Simple IP fragment reassembly won't be enough.
- huhtenberg 6y agoFor the latter, the ALG needs to check that the connection starts with a SIP packet and disable any further processing if does not.
- gnfargbl 6y agoAgreed. I'm labouring the point because a lot of comments here are waving this away as a one-line stateless change ("just check the fragmentation offset is zero"), when in fact it might mean switching from a completely stateless ALG to a stateful ALG. That is a bigger deal from the code complexity point of view, because it means the ALG has to start tracking TCP connections.
- twic 6y agoIf the device is doing NAT, it already keeps track of whether a TCP connection is new or not. It feels like it should be easy enough to check that state when applying the ALG rule. Or can a SIP REGISTER happen in a packet after the first?
- xuhu 6y agoI just tested whether my router has SIP ALG enabled with a test account on antisip.com (any provider will do), and softphones running on two devices. After initiating a call, I obtained the 'Contact:' IP and port from Wireshark live traces and used a port checker tool to test whether the router set up a forwarding rule.
- api 6y agoMeh. There's this and a hundred other ways to get past a firewall, and NAT is an ugly hack to extend the life of IPv4 not a security feature. Firewalls are a false god. If something can't be connected to the open network and remain reasonably secure, it is not secure. Firewalls are a necessary evil because there's a lot of insecure junk, sure, but relying on them encourages more insecure junk to be made and encourages lazy security practices in general.
- rossmohax 6y agoIn the meantime every router comes with UPNP enabled, designed specifically to open ports on router for incoming connections
- MayeulC 6y ago> You could use dd, however you'd want a large bs (block size) so that it would output quickly, eg 1024, however the skip attribute (to tell it to start at the location of the squashfs blob) would respect the block size and 2221098 isn’t obviously divisible in anything quickly in my head other than 2… In GNU coreutils, you can do: dd if=/dev/zero of=/tmp/z bs=8M conv=skip_bytes skip=2221098 https://www.man7.org/linux/man-pages/man1/dd.1.html https://www.man7.org/linux/man-pages/man1/dd.1.html Same with count_bytes. Very useful at times.
- momobozo 6y agoMy understanding from reading this is that it requires ALG to be supported by the firewall/router. pfSense doesn’t seek to have ALG as an option to enable. Am I correct in my assumption that this does not affect a network using pfSense as its firewall?