# 6.2.1 Session Hijacking

## Session Hijacking

Session Hijacking, also known as session theft, is a security attack where an attacker illegitimately takes over a user's active session on a web app.

In this type of attack, the attacker gains unauthorized access tot he user's session token or identifier, allowing them to impersonate the victim and perform actions on their behalf.

### Phase 1 - Token Acquisition

* **Session Prediction**: predicting or guessing the session token, especially if it's predictable or lacks sufficient randomness.
* **Session Sniffing**: intercepting the session token as it's transmitted over an unsercured network, such as an open Wi-Fi hotspot
* **Cross-Site Scripting (XSS)**: exploiting a vulnerability in the web app to inject malicious JavaScript code into a victim's browser, which can steal the session token.

### Phase 2 - Impersonation

When the attacker has the session token, they can impersonate the victim by presenting this token during requests to the web app.

The app not protected by hijacking, treats the attacker as the authenticated user.

### Impact

* **Data Theft:** access and steal the victim's sensitive data, such as personal info, financial details or confidential documents.
* **Account Takeove**r: change the victim's account setting, passwords, or email address, locking the victim out of their account.
* **Malicious Transactions**: conduct unauthorized transactions, make purchases, or manipulate the victim's data.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev-angelist.gitbook.io/ewptxv3-notes/readme/5.5-other-common-web-attacks/5.5.1-session-attacks/6.2.1-session-hijacking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
