> For the complete documentation index, see [llms.txt](https://kunalwalavalkar.gitbook.io/write-ups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kunalwalavalkar.gitbook.io/write-ups/dvwa/weak-session-ids.md).

# Weak Session IDs

> #### Objective
>
> This module uses four different ways to set the dvwaSession cookie value, the objective of each level is to work out how the ID is generated and then infer the IDs of other system users.

##

## Security Level: Low

> The cookie value should be very obviously predictable.&#x20;

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FzQYTCnWMMAXF5DBGAWUl%2F1.png?alt=media&amp;token=622772b9-02e4-4a63-8dfc-e608a61d433b" alt=""><figcaption></figcaption></figure>

* Let's inspect the page and check for the cookies.&#x20;

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FBX9Ya91rSAGYalEeCmuD%2F2.png?alt=media&amp;token=2005fa6d-63fc-480d-bc00-1fc3714b2bb4" alt=""><figcaption></figcaption></figure>

* As we can see, the `dvwaSession` cookie is set to 1. Let's click on the `Generate` button and check what happens.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2F1WBAzT9zRUgeFUI77Azg%2F3.png?alt=media&amp;token=4603f92c-3252-466e-9ad8-c3fe72eff155" alt=""><figcaption></figcaption></figure>

* The `dvwaSession` cookie is now set to 1. Now we know that the application increments the cookie every time the user clicks on the `Generate` button.
* We could also check the provided source code to be sure.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2F9m0RjWWem0NqoGw03Kx0%2F4.png?alt=media&amp;token=d1d15b58-b31d-441d-94d5-39acc949a02a" alt=""><figcaption></figcaption></figure>

##

## Security Level: Medium

> The value looks a little more random than on low but if you collect a few you should start to see a pattern.

* In this level the value of the `dvwaSession` cookie increments by 1 the first we click the button and then by 2.
* This process is repeated as many times as the user clicks the button.
