Jump to content

Session hijacking: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
Tags: Visual edit Mobile edit Mobile web edit
m Modify More citations needed template from section to article.
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Short description|Exploitation of a valid computer session}}
{{Short description|Exploitation of a valid computer session}}
{{Refimprove section|date=June 2010}}
{{Refimprove|date=June 2010}}
In [[computer science]], '''session hijacking''', sometimes also known as '''cookie hijacking''', is the exploitation of a valid [[Session (computer science)|computer session]]—sometimes also called a ''session key''—to gain unauthorized access to information or services in a computer system. In particular, it is used to refer to the theft of a magic cookie used to authenticate a user to a remote server. It has particular relevance to [[web developer]]s, as the HTTP cookies used to maintain a session on many websites can be easily stolen by an attacker using an intermediary computer or with access to the saved cookies on the victim's computer (see HTTP cookie theft). After successfully stealing appropriate session cookies an adversary might use the Pass the Cookie technique to perform session hijacking. Cookie hijacking is commonly used against client authentication on the internet. Modern web browsers use cookie protection mechanisms to protect the web from being attacked.<ref name=":1">{{Cite journal |last1=Bugliesi |first1=Michele |last2=Calzavara |first2=Stefano |last3=Focardi |first3=Riccardo |last4=Khan |first4=Wilayat |date=2015-09-16 |title=CookiExt: Patching the browser against session hijacking attacks |url=http://dx.doi.org/10.3233/jcs-123456 |journal=Journal of Computer Security |volume=23 |issue=4 |pages=509–537 |doi=10.3233/jcs-150529 |issn=1875-8924 |hdl-access=free |hdl=10278/3663357}}</ref>
In [[computer science]], '''session hijacking''', sometimes also known as '''cookie hijacking''', is the [[exploit (computer security)|exploitation]] of a valid [[session (computer science)|computer session]]—sometimes also called a ''session key''—to gain unauthorized access to information or services in a computer system. In particular, it is used to refer to the theft of a magic cookie used to authenticate a user to a remote server. It has particular relevance to web developers, as the HTTP cookies used to maintain a session on many websites can be easily stolen by an attacker using an intermediary computer or with access to the saved cookies on the victim's computer (see [[HTTP cookie#Cookie theft and session hijacking|HTTP cookie theft]]). After successfully stealing appropriate session cookies an adversary might use the Pass the Cookie technique to perform session hijacking. Cookie hijacking is commonly used against client authentication on the internet. Modern web browsers use cookie protection mechanisms to protect the web from being attacked.<ref name=":1">{{Cite journal |last1=Bugliesi |first1=Michele |last2=Calzavara |first2=Stefano |last3=Focardi |first3=Riccardo |last4=Khan |first4=Wilayat |date=2015-09-16 |title=CookiExt: Patching the browser against session hijacking attacks |journal=Journal of Computer Security |volume=23 |issue=4 |pages=509–537 |doi=10.3233/jcs-150529 |issn=1875-8924 |hdl-access=free |hdl=10278/3663357}}</ref>


A popular method is using [[Source routing|source-routed]] IP packets. This allows an attacker at point ''B'' on the network to participate in a conversation between ''A'' and ''C'' by encouraging the IP packets to pass through ''B's'' machine.
A popular method is using source-routed IP packets. This allows an attacker at point ''B'' on the network to participate in a conversation between ''A'' and ''C'' by encouraging the IP packets to pass through ''B's'' machine.


If source-routing is turned off, the attacker can use "blind" hijacking, whereby it guesses the responses of the two machines. Thus, the attacker can send a command, but can never see the response. However, a common command would be to set a password allowing access from elsewhere on the net.
If source-routing is turned off, the attacker can use "blind" hijacking, whereby it guesses the responses of the two machines. Thus, the attacker can send a command, but can never see the response. However, a common command would be to set a password allowing access from elsewhere on the net.


An attacker can also be "inline" between ''A'' and ''C'' using a sniffing program to watch the conversation. This is known as a "[[man-in-the-middle attack]]".
An attacker can also be "inline" between ''A'' and ''C'' using a sniffing program to watch the conversation. This is known as a "man-in-the-middle attack".


==History of HTTP==
==History of HTTP==
HTTP protocol versions 0.8 and 0.9 lacked cookies and other features necessary for session hijacking. Version 0.9beta of Mosaic Netscape, released on October 13, 1994, supported cookies.
HTTP protocol versions 0.8 and 0.9 lacked cookies and other features necessary for session hijacking. Version 0.9beta of Mosaic Netscape, released on October 13, 1994, supported cookies.


Early versions of HTTP 1.0 did have some security weaknesses relating to session hijacking, but they were difficult to exploit due to the vagaries of most early HTTP 1.0 servers and browsers. As HTTP 1.0 has been designated as a fallback for HTTP 1.1 since the early 2000s—and as HTTP 1.0 servers are all essentially HTTP 1.1 servers the session hijacking problem has evolved into a nearly permanent security risk.<ref>{{cite web|url=https://cwatch.comodo.com/blog/website-security/what-is-session-hijacking/|title=Session Hijacking & HTTP Communication |date=19 October 2020 }}</ref>
Early versions of HTTP 1.0 did have some security weaknesses relating to session hijacking, but they were difficult to exploit due to the vagaries of most early HTTP 1.0 servers and browsers. As HTTP 1.0 has been designated as a fallback for HTTP 1.1 since the early 2000s—and as HTTP 1.0 servers are all essentially HTTP 1.1 servers the session hijacking problem has evolved into a nearly permanent security risk.<ref>{{cite web|url=https://cwatch.comodo.com/blog/website-security/what-is-session-hijacking/|title=Session Hijacking & HTTP Communication |date=19 October 2020 | archiveurl = https://web.archive.org/web/20201031013639/https://cwatch.comodo.com/blog/website-security/what-is-session-hijacking/ | archivedate = 2020-10-31 | url-status = live}}</ref>{{Failed verification | date = August 2024 | reason = The reference doesn't mention anything about HTTP 1.0/1.1 servers, and how they are related to make them a 'permanent' security problem. It does make a good reference for the article.}}


The introduction of [[HTTP cookie#Supercookie|supercookies]] and other features with the modernized HTTP 1.1 has allowed for the hijacking problem to become an ongoing security problem. Webserver and browser state machine standardization has contributed to this ongoing security problem.
The introduction of [[HTTP cookie#Supercookie|supercookies]] and other features with the modernized HTTP 1.1 has allowed for the hijacking problem to become an ongoing security problem. Webserver and browser state machine standardization has contributed to this ongoing security problem.
Line 29: Line 29:


===Firesheep===
===Firesheep===
In October 2010, a [[Mozilla Firefox]] extension called [[Firesheep]] was released, and it provided an easy access point for session hijackers to attack users of unencrypted public Wi-Fi. Websites like [[Facebook]], [[Twitter]], and any that the user adds to their preferences allow the Firesheep user to easily access private information from cookies and threaten the public Wi-Fi user's personal property.<ref>{{cite news |url=http://www.h-online.com/open/news/item/Firefox-extension-steals-Facebook-Twitter-etc-sessions-1124596.html |title=Firefox extension steals Facebook, Twitter, etc. sessions |work=The H |date=25 October 2010 }}</ref> Only months later, Facebook and Twitter responded by offering (and later requiring) [[HTTP Secure]] throughout.<ref>{{cite news |url=http://www.h-online.com/security/news/item/Facebook-now-SSL-encrypted-throughout-1178190.html |title=Facebook now SSL-encrypted throughout |work=The H |date=27 January 2011 }}</ref><ref>{{cite news |url=http://www.h-online.com/security/news/item/Twitter-adds-Always-use-HTTPS-option-1209032.html |title=Twitter adds 'Always use HTTPS' option |work=The H |date=16 March 2011 }}</ref>
[[Firesheep]], a [[Firefox]] extension introduced in October 2010, demonstrated session hijacking vulnerabilities in unsecured networks. It captured unencrypted cookies from popular websites, allowing users to take over active sessions of others on the same network. The tool worked by displaying potential targets in a sidebar, enabling session access without password theft. The websites supported included [[Facebook]], [[Twitter]], [[Flickr]], [[Amazon (company)|Amazon]], [[Windows Live]] and [[Google]], with the ability to use scripts to add other websites.<ref>{{cite news |url=http://www.h-online.com/open/news/item/Firefox-extension-steals-Facebook-Twitter-etc-sessions-1124596.html |title=Firefox extension steals Facebook, Twitter, etc. sessions |work=The H |date=25 October 2010 | archiveurl = https://web.archive.org/web/20240306061808/http://www.h-online.com/open/news/item/Firefox-extension-steals-Facebook-Twitter-etc-sessions-1124596.html | archivedate = 2024-03-06 | url-status = dead }}</ref> Only months later, Facebook and Twitter responded by offering (and later requiring) [[HTTP Secure]] throughout.<ref>{{cite news |url=http://www.h-online.com/security/news/item/Facebook-now-SSL-encrypted-throughout-1178190.html |title=Facebook now SSL-encrypted throughout |work=The H |date=27 January 2011 }}</ref><ref>{{cite news |url=http://www.h-online.com/security/news/item/Twitter-adds-Always-use-HTTPS-option-1209032.html |title=Twitter adds 'Always use HTTPS' option |work=The H |date=16 March 2011 }}</ref>

===WhatsApp sniffer===
An app named WhatsApp Sniffer was made available on [[Google Play]] in May 2012. It was able to display messages from other [[WhatsApp]] users connected to the same network as the app user.<ref>{{cite news |url=http://www.h-online.com/security/news/item/Sniffer-tool-displays-other-people-s-WhatsApp-messages-1574382.html |title=Sniffer tool displays other people's WhatsApp messages |work=The H |date=13 May 2012 }}</ref> At that time WhatsApp used an [[XMPP]] infrastructure with encryption, not plain-text communication.<ref>{{cite news |url=http://www.h-online.com/security/news/item/WhatsApp-no-longer-sends-plain-text-1674723.html |title=WhatsApp no longer sends plain text |work=The H |date=24 August 2012 }}</ref>


===DroidSheep===
===DroidSheep===
Line 38: Line 35:


===CookieCadger===
===CookieCadger===
CookieCadger is a graphical Java app that automates sidejacking and replay of HTTP requests, to help identify information leakage from applications that use unencrypted GET requests. It is a cross-platform open-source utility based on the [[Wireshark]] suite which can monitor wired Ethernet, insecure Wi-Fi, or load a packet capture file for offline analysis. Cookie Cadger has been used to highlight the weaknesses of youth team sharing sites such as Shutterfly (used by AYSO soccer league) and TeamSnap.<ref>{{cite web|url=https://www.motherjones.com/politics/2013/05/shutterfly-teamsnap-eteamz-ssl-hackers-kids-datal|title=How Shutterfly and Other Social Sites Leave Your Kids Vulnerable to Hackers|work=Mother Jones|date=3 May 2013}}</ref>
CookieCadger is a graphical Java app that automates sidejacking and replay of HTTP requests, to help identify information leakage from applications that use unencrypted GET requests. It is a cross-platform open-source utility based on the [[Wireshark]] suite which can monitor wired Ethernet, insecure Wi-Fi, or load a packet capture file for offline analysis. Cookie Cadger has been used to highlight the weaknesses of youth team sharing sites such as Shutterfly (used by AYSO soccer league) and TeamSnap.<ref>{{cite web | url = https://www.motherjones.com/politics/2013/05/shutterfly-teamsnap-eteamz-ssl-hackers-kids-data/ | title = How Shutterfly and Other Social Sites Leave Your Kids Vulnerable to Hackers | work = Mother Jones | date = 2013-05-03 | archiveurl = https://web.archive.org/web/20240519210800/https://www.motherjones.com/politics/2013/05/shutterfly-teamsnap-eteamz-ssl-hackers-kids-data/ | archivedate = 2024-05-19 | url-status = live}}</ref>


==Prevention==
==Prevention==

Revision as of 22:03, 10 August 2024

In computer science, session hijacking, sometimes also known as cookie hijacking, is the exploitation of a valid computer session—sometimes also called a session key—to gain unauthorized access to information or services in a computer system. In particular, it is used to refer to the theft of a magic cookie used to authenticate a user to a remote server. It has particular relevance to web developers, as the HTTP cookies used to maintain a session on many websites can be easily stolen by an attacker using an intermediary computer or with access to the saved cookies on the victim's computer (see HTTP cookie theft). After successfully stealing appropriate session cookies an adversary might use the Pass the Cookie technique to perform session hijacking. Cookie hijacking is commonly used against client authentication on the internet. Modern web browsers use cookie protection mechanisms to protect the web from being attacked.[1]

A popular method is using source-routed IP packets. This allows an attacker at point B on the network to participate in a conversation between A and C by encouraging the IP packets to pass through B's machine.

If source-routing is turned off, the attacker can use "blind" hijacking, whereby it guesses the responses of the two machines. Thus, the attacker can send a command, but can never see the response. However, a common command would be to set a password allowing access from elsewhere on the net.

An attacker can also be "inline" between A and C using a sniffing program to watch the conversation. This is known as a "man-in-the-middle attack".

History of HTTP

HTTP protocol versions 0.8 and 0.9 lacked cookies and other features necessary for session hijacking. Version 0.9beta of Mosaic Netscape, released on October 13, 1994, supported cookies.

Early versions of HTTP 1.0 did have some security weaknesses relating to session hijacking, but they were difficult to exploit due to the vagaries of most early HTTP 1.0 servers and browsers. As HTTP 1.0 has been designated as a fallback for HTTP 1.1 since the early 2000s—and as HTTP 1.0 servers are all essentially HTTP 1.1 servers the session hijacking problem has evolved into a nearly permanent security risk.[2][failed verification]

The introduction of supercookies and other features with the modernized HTTP 1.1 has allowed for the hijacking problem to become an ongoing security problem. Webserver and browser state machine standardization has contributed to this ongoing security problem.

Methods

There are four main methods used to perpetrate a session hijack. These are:

  • Session fixation, where the attacker sets a user's session ID to one known to them, for example by sending the user an email with a link that contains a particular session ID. The attacker now only has to wait until the user logs in.
  • Session side jacking, where the attacker uses packet sniffing to read network traffic between two parties to steal the session cookie. Many websites use SSL encryption for login pages to prevent attackers from seeing the password, but do not use encryption for the rest of the site once authenticated. This allows attackers that can read the network traffic to intercept all the data that is submitted to the server or web pages viewed by the client. Since this data includes the session cookie, it allows them to impersonate the victim, even if the password itself is not compromised.[3] Unsecured Wi-Fi hotspots are particularly vulnerable, as anyone sharing the network will generally be able to read most of the web traffic between other nodes and the access point.
  • Cross-site scripting, where the attacker tricks the user's computer into running code which is treated as trustworthy because it appears to belong to the server, allowing the attacker to obtain a copy of the cookie or perform other operations.
  • Malware and unwanted programs can use browser hijacking to steal a browser's cookie files without a user's knowledge, and then perform actions (like installing Android apps) without the user's knowledge.[4] An attacker with physical access can simply attempt to steal the session key by, for example, obtaining the file or memory contents of the appropriate part of either the user's computer or the server.

After successfully acquiring appropriate session cookies an adversary might leverage the Pass the Cookie technique to perform session hijacking.

Exploits

Firesheep

Firesheep, a Firefox extension introduced in October 2010, demonstrated session hijacking vulnerabilities in unsecured networks. It captured unencrypted cookies from popular websites, allowing users to take over active sessions of others on the same network. The tool worked by displaying potential targets in a sidebar, enabling session access without password theft. The websites supported included Facebook, Twitter, Flickr, Amazon, Windows Live and Google, with the ability to use scripts to add other websites.[5] Only months later, Facebook and Twitter responded by offering (and later requiring) HTTP Secure throughout.[6][7]

DroidSheep

DroidSheep is a simple Android tool for web session hijacking (sidejacking). It listens for HTTP packets sent via a wireless (802.11) network connection and extracts the session id from these packets in order to reuse them. DroidSheep can capture sessions using the libpcap library and supports: open (unencrypted) networks, WEP encrypted networks, and WPA/WPA2 encrypted networks (PSK only). This software uses libpcap and arpspoof.[8][9] The apk was made available on Google Play but it has been taken down by Google.

CookieCadger

CookieCadger is a graphical Java app that automates sidejacking and replay of HTTP requests, to help identify information leakage from applications that use unencrypted GET requests. It is a cross-platform open-source utility based on the Wireshark suite which can monitor wired Ethernet, insecure Wi-Fi, or load a packet capture file for offline analysis. Cookie Cadger has been used to highlight the weaknesses of youth team sharing sites such as Shutterfly (used by AYSO soccer league) and TeamSnap.[10]

Prevention

Methods to prevent session hijacking include:

  • Encryption of the data traffic passed between the parties by using SSL/TLS; in particular the session key (though ideally all traffic for the entire session[11]). This technique is widely relied-upon by web-based banks and other e-commerce services, because it completely prevents sniffing-style attacks. However, it could still be possible to perform some other kind of session hijack. In response, scientists from the Radboud University Nijmegen proposed in 2013 a way to prevent session hijacking by correlating the application session with the SSL/TLS credentials[12]
  • Use of a long random number or string as the session key. This reduces the risk that an attacker could simply guess a valid session key through trial and error or brute force attacks.
  • Regenerating the session id after a successful login. This prevents session fixation because the attacker does not know the session id of the user after they have logged in.
  • Some services make secondary checks against the identity of the user. For instance, a web server could check with each request made that the IP address of the user matched the one last used during that session. This does not prevent attacks by somebody who shares the same IP address, however, and could be frustrating for users whose IP address is liable to change during a browsing session.
  • Alternatively, some services will change the value of the cookie with each and every request. This dramatically reduces the window in which an attacker can operate and makes it easy to identify whether an attack has taken place, but can cause other technical problems (for example, two legitimate, closely timed requests from the same client can lead to a token check error on the server).
  • Users may also wish to log out of websites whenever they are finished using them.[13][14] However this will not protect against attacks such as Firesheep.

See also

References

  1. ^ Bugliesi, Michele; Calzavara, Stefano; Focardi, Riccardo; Khan, Wilayat (2015-09-16). "CookiExt: Patching the browser against session hijacking attacks". Journal of Computer Security. 23 (4): 509–537. doi:10.3233/jcs-150529. hdl:10278/3663357. ISSN 1875-8924.
  2. ^ "Session Hijacking & HTTP Communication". 19 October 2020. Archived from the original on 2020-10-31.
  3. ^ "Warning of webmail wi-fi hijack". BBC News. August 3, 2007.
  4. ^ "Malware use Browser Hijacking to steal cookie". 19 October 2020.
  5. ^ "Firefox extension steals Facebook, Twitter, etc. sessions". The H. 25 October 2010. Archived from the original on 2024-03-06.
  6. ^ "Facebook now SSL-encrypted throughout". The H. 27 January 2011.
  7. ^ "Twitter adds 'Always use HTTPS' option". The H. 16 March 2011.
  8. ^ "DroidSheep".
  9. ^ "DroidSheep Blog". Archived from the original on 2016-11-20. Retrieved 2012-08-07.
  10. ^ "How Shutterfly and Other Social Sites Leave Your Kids Vulnerable to Hackers". Mother Jones. 2013-05-03. Archived from the original on 2024-05-19.
  11. ^ "Schneier on Security: Firesheep". 27 October 2010. Retrieved 29 May 2011.
  12. ^ Burgers, Willem; Roel Verdult; Marko van Eekelen (2013). "Prevent Session Hijacking by Binding the Session to the Cryptographic Network Credentials". Secure IT Systems. Lecture Notes in Computer Science. Vol. 8208. pp. 33–50. doi:10.1007/978-3-642-41488-6_3. ISBN 978-3-642-41487-9.
  13. ^ See "NetBadge: How To Log Out".
  14. ^ See also "Be Card Smart Online - Always log out".