1 / 29

Know Thyself

Know Thyself. Dieter Gollmann Hamburg University of Technology Germany. Thesis. To enforce (same) origin policies, you have to be able to authenticate origin. Even when you are unable to authenticate the origin of inputs provided by others, you may still be able to authenticate your own.

farica
Download Presentation

Know Thyself

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Know Thyself Dieter Gollmann Hamburg University of Technology Germany

  2. Thesis • To enforce (same) origin policies, you have to be able to authenticate origin. • Even when you are unable to authenticate the origin of inputs provided by others, you may still be able to authenticate your own. • Can we use an elementary security primitive “Recognizing yourself”?

  3. Owls to OWASP • Web application vulnerabilities like XSS or XSRF are a major security concern today. • Is there something to be learned from security mechanisms developed for mobile systems?

  4. page with malicious instructions Cross-site Scripting Page with instr. Page with instr. Form with [instr.] trusted zone Form with [instr.] Stored XSS Reflected XSS firewall Malicious instructions encoded as data attacker.com untrusted zone

  5. authenticated tunnel user target system form with instr. firewall form with malicious instructions attacker.com untrusted zone XSRF

  6. Cross-site scripting (XSS) • Parties involved: Attacker, client (victim), server (‘trusted’ by client). • Attacker places malware on a page at server (stored XSS) or gets victim to include attacker’s code in a request to the server (reflected XSS). • Malware contained in page returned by server to client; executed at client with permissions of the trusted server. • Violation of an origin based security policy.

  7. XSRF attack • Parties involved: Attacker, user, target website (victim). • User authenticated at target (cookie, SSL session,…). • User has to visit the attacker’s webpage that contains hidden malware, e.g. in an HTML form. • When the user browses this page, it automatically submits the malware to a target site where the user has access. • Target authenticates request as coming from user; form data accepted since it comes from a legitimate user. • Evades target’s origin based security policy.

  8. Causes & Defences • Ultimate cause of XSS attack: The client only authenticates ‘the last hop’ of the entire page, but not the true origin of all parts of the page. • Ultimate cause of XSRF attack: The server only authenticates ‘the last hop’ of the entire page, but not the true origin of all parts of the page. • Defence 1: Do not rely on origin based policies; differentiate between code and data instead. • Defence 2: Authenticate your own requests.

  9. Defence 1 • Filter client inputs, sanitize server outputs, escape dangerous characters. • Do you know all paths malicious code can arrive? • DOM-based XSS! • Do you know how filtered input is processed further? • Will a helpful component change くor ‹  to <? • Do you know about all interactions between different layers of abstraction? • Addslashes and the GBK character set (simplified Chinese): • 0xbf27  0xbf5c27 (0x27 encodes ‘ ) • Chris Shiflett: http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-real-escape-string

  10. Interlude – Mobile IPv6

  11. MIPv6 Security (RFC 3775) • Mobile node has secure tunnel to home agent where it as a home address. • Mobile node moves and informs correspondent node about its new care-of-address address. • Correspondent node updates its binding cache. • A malicious (mobile) node may lie about its location; e.g. to launch a bombing attack. • Secure binding update with return routability: Challenges sent to identity and location, response binds identity to location. • Cryptographic keys are sent in the clear!

  12. Binding update protocol [RFC 3775] Challenge sent to home address HoTI home CN HoT: K0, i Challenge sent to location CoTI binds home address to location CoT: K1, j MN 3: MAC(Kbm;CoA, CN, BU)

  13. BU Protocol • Mobile sends two BU init messages to the correspondent, one via the home agent, the other on the direct link. • Correspondent constructs a key for each of the two BU init messages, returns these keys K0and K1independently to mobile. • Binding key Kbm = SHA-1(K0,K1) used by mobile to authenticate the binding update; authentication binds location (care-of-address) to identity (home address).

  14. Ownership of addresses • Dynamic address allocation schemes checks that a new address is still free: broadcasts query asking whether any node on the network already uses this address. • Squatting attack: Attacker falsely claims to have the address that should be allocated; prevents victim from obtaining an address in the network. • Can a node prove that it “owns” an IP address without relying on third party (home agent, CA)? • Use public key cryptography without an PKI.

  15. CGA: Cryptographically Generated Addresses • Address owner creates a public key/ private key pair; hash of the public key as interface ID in an IPv6 address. • Mobile node signs BU information with its private key; sends the signed BU together with its public key to the correspondent. • Correspondent checks that the public verification key is linked to the IP address. • Address is “certificate” for its public key.

  16. private key public key hash interface ID subnet prefix two reserved bits Cryptographically Generated Addresses (basic idea)

  17. Back to Web applications

  18. Authenticating origin • Authentication: “Know whom you are talking to.” • Bad definition: Computers do not talk; too narrow generalization from communications security. • Better: Authentication binds different elements in an IT system, e.g. identity and location. • Web applications: Bind parts of a page to their origin. • This may be difficult, and may not be necessary. • Know thyself: Recognize the parts you have contributed. • Identification: Recognize those parts that come from the same source. • Pekka Nikander: identidem = same as before

  19. Authentication in Web applications • XSS defence: Server sends unpredictable one-time URLs to the client during session establishment; server can recognize these URLs as ‘its own’ and can authenticate requests as originating directly from the client. • One-time URLs have to be stored in a safe place at the client. • Source: Martin Johns: SessionSafe • Server initiated XSRF defence: Authenticate requests at level of the Web application (‘above’ the browser); application sends authenticators with each action: • XSRFPreventionToken, e.g. HMAC(Action_Name+Secret, SessionID); • Random XSRFPreventionToken or random session cookie.

  20. Authentication in Web applications • Client-side only XSRF defence for HTTP layer sessions : • Proxy between browser and network marks all URLs in incoming web pages with unpredictable token; keeps database associating tokens with domains. • Proxy checks all outgoing requests: • Know thyself: If a token is found, the request did not originate in the client. • Identification: Proxy then checks whether its origin matches the domain the request is sent to. • Otherwise, all authenticators (SIDs, cookies) added by the browser are stripped from the URL. • Source: Martin Johns, RequestRodeo.

  21. DNS rebinding

  22. DNS rebinding • Web browsers enforce same origin policy: Applet can only connect back to the server it was downloaded from. • To make a connection, the client’s browser needs the IP address of the server. • Authoritative DNS server resolves ‘abstract’ DNS names in its domain to ‘concrete’ IP addresses. • Client’s browser ‘trusts’ the DNS server when enforcing the same origin policy.

  23. Trust is Bad for Security!

  24. DNS rebinding attack • “Abuse trust”: Attacker creates attacker.org domain; binds this name to two IP addresses, to its own and to the target’s address. • Client downloads applet from attacker.org; applet connects to target; permitted by same origin policy. • Defence: Same origin policy using IP address • D. Dean, E.W. Felten, D.S. Wallach: Java security: from HotJava to Netscape and beyond, 1996 IEEE Symposium on Security & Privacy.

  25. DNS rebinding attack • Next round: Javascript, 2001. • Client visits attacker.org; attacker’s DNS server resolves this name to attacker’s IP address with short time-to-live. • Attacker rebinds attacker.org to target’s address. • Malicious script connects to attacker.org, which now is resolved to the target’s address. • Defence: Do not trust server on time-to-live; keep time yourself and pin host name to original IP address. • J. Roskind: Attacks against the Netscape browser. in RSA Conference, April 2001.

  26. DNS rebinding attack • Next round: Browser plug-ins that do their own pinning. • More sophisticated authorisation system: Client browser refers to policy obtained from DNS server when deciding on connection requests. • Dangerous constellation: • Communication path between plug-ins. • Each plug-in has its own pinning database.

  27. DNS rebinding attack • Attacker may use the client’s browser as a proxy to attack the target. • Defence: Centralize security controls; one pinning database for all plug-ins; e.g., let all plug-ins use the browser’s pins. • Defence: Do not ask DNS server for the policy but the system with the IP address a DNS name is being resolved to. • Similar to reverse DNS lookup. • Similar to defences against bombing attacks.

  28. Conclusions • You cannot enforce a security policy if you cannot authenticate the attributes it refers to. • Challenge: With origin based policies, how to authenticate the location a data item came from? It might have travelled a long way. • Which end point is being authenticated? Terms like ‘the server’ or ‘the client’ are too imprecise. • Challenge: How to authenticate location without a suitable infrastructure? • Know thyself and double check?

  29. What to look out for? • Mashups, web feeds, and syndications. • With same origin policies the fun is just starting. • HTTP access control headers for cross-domain policies. • AJAX cross-domain policies. • Who will set those policies? • Who will enforce those policies? • Who can authenticate their attributes?

More Related