wifi security or or descending into depression g p and
play

Wifi Security -or- or Descending Into Depression g p and Drink - PowerPoint PPT Presentation

Wifi Security -or- or Descending Into Depression g p and Drink Mike Kershaw / Dragorn d dragorn@kismetwireless.net @ki i l The plan 802.11 networks Well defended APs Well-defended APs Less Basic vulnerabilities


  1. More Man-in-the-middle • Why just attack the browser? • Many sites encrypt login, but not M it t l i b t t session • Session cookies, data, etc vuln • “The Middler”, SSLSniff, Cookie Monster • Hijack sessions via MITM

  2. This bores me • All of these attacks are really pretty boring tt b i • Why? They're really obvious Why? They re really obvious. • Might still get some users, but it'll be pretty blatant • Points ARE awarded for style. P i ARE d d f l Or at least, for stealth. Or at least, for stealth.

  3. So wait... • Didn't we say 802.11 is shared media !? di !? • We just found the best time • We just found the best time machine ever !

  4. And not some hippy do-gooder time machine either time machine, either

  5. But one where we get to bring back g g weapons from the future

  6. The bad old days • Hair metal, grunge, ripped jeans • Unswitched shared media Ethernet Ethernet... • Sniffing the entire segment … • TCP session hijacking... TCP session hijacking...

  7. That's too easy • It'd never be that easy, right? • Right ? • People have to have gotten • People have to have gotten smarter by now... • You'd never take a system from a secure network to an insecure k i network, right ? network, right ?

  8. Mmm, latte • … and airports • The gym • A hotel • A hotel • Bookstores • McDonalds • Conferences

  9. Making a mess • Management frames have no protection t ti • Open networks have no client Open networks have no client protection • Nothing stops us from spoofing the AP and talking directly to a the AP and talking directly to a client!

  10. No protection • AP may filter inter-client communication by blocking packets communication by blocking packets when they hit the AP • By generating an 802.11 header FROM B i 802 11 h d FROM the AP and TO the client • The client thinks the packet is legit • The AP has no opportunity to act on it • The AP has no opportunity to act on it • We can communicate directly with “protected” clients on open networks

  11. Shooting up • Most modern cards use “soft” MAC control layers MAC control layers • Most of the control offloaded to the OS • Only certain timing critical stuff O l t i ti i iti l t ff handled in the firmware • This means we can send anything we like (usually) we like (usually)

  12. The shakes • Unfortunately there aren't really any standards for injection t d d f i j ti • Every OS does it differently Every OS does it differently • Different drivers do it differently • Sometimes needs custom S i d headers per packet headers per packet

  13. Making it easy: LORCON • Writing the same injection code f for every app sucks k • Writing custom code for each Writing custom code for each driver sucks • Writing apps for each OS sucks • Hopefully LORCON doesn't H f ll LORCON d ' suck suck

  14. LORCON2 • Unfortunately... the LORCON1 API API... kind of sucked kind of sucked • New API modeled off of PCAP • Designed to be easy to use • C, Ruby API • Will soon support all the cards Will soon support all the cards LORCON1 did, for now, Linux • http://802.11ninja.net

  15. Super simple • Automatically determines the d i driver • Automatically configures Automatically configures virtual network interfaces and sets up modes for injection • Send arbitrary bytes or use • Send arbitrary bytes -or- use packet assembly API p y

  16. The most basic lorcon_driver_t *dri; lorcon_t *ctx; uint8_t packet[...]; int8 t packet[ ] dri = lorcon_auto_driver(“wlan0”); _ _ ctx = lorcon_create(“wlan0”, dri); lorcon_open_injmon(ctx); lorcon_set_channel(ctx, 6); lorcon_send_bytes(ctx, sizeof(packet), packet); ( ( ) )

  17. The inspiration • Wifi session hijacking • About 5 years ago, Toast debuted Ab t 5 T t d b t d Airpwn at defcon p • TCP stream hijacking on 802.11 • Why hasn't everyone been using this !? • Not just for shock-porn anymore!

  18. Rerouting streams • Typical layer2 attack • TCP is only “secure” because the seq/ack is unknown the seq/ack is unknown • Attacker sees your L2, so seqno is known • Any TCP stream subject to A TCP bj abuse abuse

  19. Anatomy of a session • Handshake • Client → Server “GET /foo html HTTP/1 0” GET /foo.html HTTP/1.0 Seq 123 ack 10 • Server ← Client “HTTP headers content” HTTP headers, content Seq 10 ack 189 q

  20. So lets add this to MSF • Lorcon Ruby wrapper • Racket packet assembly (high speed Ruby packet assembly) speed Ruby packet assembly) • Ruby PCAP • And a little TLC

  21. Anatomy of an Evil session • Handshake • Client → Server Client → Server “GET /foo.html HTTP/1.0” [seq/ack] • MSF ← Client • MSF ← Client “Malicious data...” [seq/ack] • MSF ← Client FIN! MSF Cli FIN! • MSF → Server FIN! [using client seq/ack] • Server ← Client “Real data!” [old seq/ack] [ q ]

  22. MSF msf > use auxiliary/spoof/wifi/airpwn msf auxiliary(airpwn) > set INTERFACE alfa0 INTERFACE INTERFACE => alfa0 > lf 0 msf auxiliary(airpwn) > set RESPONSE f ili ( i ) t S O S "Airpwn - MSF!" RESPONSE => Airpwn RESPONSE => Airpwn – MSF! MSF! msf auxiliary(airpwn) > run msf auxiliary(airpwn) > run

  23. MSF msf auxiliary(airpwn) > run [*] AIRPWN: Response packet has no HTTP headers, creating some. [*] Auxiliary module execution completed msf auxiliary(airpwn) > f ili ( i ) [*] AIRPWN: 10.10.100.42 -> 208 127 144 14 HTTP GET 208.127.144.14 HTTP GET [/files/racket/src/doc/] TCP SEQ 542050816

  24. Fine-tuning • Match & replace in regex • Response can be full JS, image replacement HTML a file replacement, HTML, a file • Sitelist YAML file for matching specific requests (poison lists of known files like jquery) known files, like jquery)

  25. Autogen • Airpwn-MSF automatically generates HTTP headers as t HTTP h d needed • Complete attacker control of page content including headers, too too

  26. Ill-gotten profit • What does that get us? • • HTTP content replacement

  27. Or in other words... • Control over the page DOM • Control over forms • Control over the browser in • Control over the browser in general • Access to anything in the security context of the i f h compromised page compromised page

  28. Obviously scripted • So we can replace content... • What do we do now? • Nearly all complex sites include • Nearly all complex sites include a pile of javascript helper files • What happens if we replace one of those ? f h ?

  29. It's not news, it's Javascript

  30. JS Fragments • Especially attractive • Totally invisible to the user • Multiple requests = Multiple • Multiple requests = Multiple opportunities to land attack • Run in same privilege domain as web page b

  31. I'm in your browser • Rewriting your DOM • DOM = Document Object Model Model • Programmatic manipulation of page content • Once in the DOM we can do O i h DOM d ANYTHING ANYTHING

  32. It's not stupid, it's advanced var embeds = document.getElementsByTagName('div'); g y g ( ); for(var i=0; i < embeds.length; i++){ if ( g ){ (embeds[i].getAttribute("class") == "cnnT1Img") { embeds[i].innerHTML = "..."; } else if (embeds[i] getAttribute("class") == "cnnT1Txt") { (embeds[i].getAttribute( class ) cnnT1Txt ) { embeds[i].innerHTML = "..."; }}

  33. DOM is tasty • What else can we do? • Rewrite all FORMs to proxy R it ll FORM t through us? Sure. g • Rewrite all HTTPS to HTTP so we can capture logins and “secure” t l i d “ ” data? Yup! • Poison content topical to a conference? Tin foil hat but yes! conference? Tin foil hat, but yes!

  34. HTTP not so S var refs = document.getElementsByTagName('a'); for (var i = 0; i < refs.length; i++){ var rval = refs[i].getAttribute("href"); f [i] tAtt ib t ("h f") if (rval == null) { continue; } refs[i].setAttribute("href", f [i] tAtt ib t ("h f" rval.replace(/^https:/, "http:"); }

  35. This really matters •This matters •A lot . •No seriously •No, seriously.

  36. Persistence pays off • Who has read rsnake's VPN paper? • Attack HTTP clients via cache Att k HTTP li t i h control • Layer 2 attacks against web content can be made persistent t t b d i t t • That means once you leave... y you're still owned

  37. Fast cache • Short version of the VPN paper: • Browsers have cache • Cache by nature remains • Cache, by nature, remains around • Users don't notice • If I own your TCP session, I own your cache control own your cache control

  38. Fast cache • Client is fed a spiked JS file with cache set to 10 years cache set to 10 years • That file remains in their cache • And is re-used when they revisit th t it that site • From inside the secure office ff network (or wherever)

  39. Don't think it's a problem?

  40. Lots of victims • None of the javascript files are visible to the end user i ibl t th d • Lots of opportunities to poison Lots of opportunities to poison the files

  41. Making it happen •Cache-control: max-age=99999999, public -or- Expires: Fri, 13 May 2011 13:13:13 GMT •So we hijack a common JS file •So we hijack a common JS file •Spike it with malicious code •Set it to cache •Now when the user goes back to N h h b k work and goes to twitter again... g g

  42. Watch the spikes • User now has a spiked, cached javascript javascript • Browser will keep this and re-use it every time until it expires i il i i • Iframes? Kaminsky socket/sucket? y Load new browser exploits? • But a user would never go to Twitter at • But a user would never go to Twitter at work, right?

  43. Call home to Mom • Cache modified JS that calls home every time the page is visited every time the page is visited • Maybe no good attacks in the browser this week? hi k? • Wait for a browser 0day then flip the y p switch to include malware • Every system that has the cached call • Every system that has the cached call- home is attacked as soon as the users visit the poisoned site i i h i d i

  44. Shimming the door • Cache every page with JS shim • Shim fetches original content • DOM manipulation • DOM manipulation • Regex replacement g p • Future exposure to new browser vulnerabilities

  45. There are no innocents • No website is “innocent” • Websites that don't ask for logins are just as capable of logins are just as capable of feeding browser exploits • Any website can be poisoned with browser owning code with browser-owning code

  46. Never underestimate fools • But won't SSL solve it? • Not really, users still have to be N t ll till h t b smart enough to not accept a bad g p cert • And users would never do A d ld d something insecure, right? • OBVIOUSLY that pop star wants me to see her naked! me to see her naked!

  47. Self-made cert • Self-signed certificates are “obvious” • But we're technical people • But we re technical people • “Signed by VeriSign” vs “Signed by Verisign” • Assuming a user even looks and Assuming a user even looks and doesn't just click “OK” • Users just want the web U j h b • “Click OK until porn” p

  48. Fail Whale • Uneducated users will always fi d find a way to expose themselves t th l • But we're all smart we're fine But we re all smart, we re fine, right? • Even hackers can get fooled...

  49. Moxie Marlinspike • Moxie Marlinspike released SSL null byte attack at BH09 null-byte attack at BH09 • SSL certs validated for HTTP by y matching CN (common name) • Wildcards are allowed - *.foo.com Wild d ll d * f is valid for any host in foo.com • C strings are terminated with a null byte byte...

  50. Bob can vouch for me • You trust that the CA validated foo com before giving out the cert foo.com before giving out the cert • CA only gives out certs for owners of a d domain i • What if we got them to sign a cert for g g *<null>foo.com? • And then C code saw that null and • And then C code saw that null and stopped?

  51. It's got Moxie • Other things that use SSL for auth may be vulnerable too be vulnerable too... • Has to use common name, and has to allow wildcards ll ild d • VPN authentication? • Custom apps? • LDAP? (OpenLDAP did...) LDAP? (O LDAP did ) • If it uses the MS SSL APIs...

  52. Maybe fixed... • Sure, the Moxie bug is fixed • What about the next one? • Even smart people fall to 0day • Even smart people fall to 0day • Once your cache is poisoned, y p , it's going to stay there... • How often do YOU use public wifi? wifi?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend