Skip to content

Separate SESS-06/SESS-07 scope and add absolute timeout testing - #1587

Open
enesbaldemir wants to merge 2 commits into
OWASP:masterfrom
enesbaldemir:fix/sess-06-07-overlap
Open

enesbaldemir wants to merge 2 commits into
OWASP:masterfrom
enesbaldemir:fix/sess-06-07-overlap

Conversation

@enesbaldemir

Copy link
Copy Markdown
Contributor

Fixes #1586

  • You have validated the need for this change.
  • If this PR is one of several related changes, note what remains.

What did this PR accomplish?

Gives SESS-06 and SESS-07 each a clear scope, removes the overlap between them, and adds absolute timeout testing. Both IDs are unchanged.

WSTG-SESS-06 (Logout Functionality), now logout only

  • Removed the ### Session Timeout subsection, which duplicated SESS-07. Its two typos ("excepted", "In a banking applications") go with it.
  • The Summary still lists session timeout as part of secure session termination, but now links to SESS-07 instead of testing it here.
  • Objective changed from "Analyze the session timeout and if the session is properly killed after logout" to "Verify that the session is properly terminated server-side after logout".

WSTG-SESS-07 (Session Timeout), now all automatic expiration

  • Objectives now match the content: one for the idle timeout and one for the absolute timeout. The old objective said "hard session timeout", but the body only covered the idle timeout.
  • Summary: added a short paragraph on absolute timeout and why it's needed. The idle timeout alone doesn't stop an attacker who keeps a hijacked session busy. I replaced the cookie-replay explanation duplicated from SESS-06 with one sentence and a link.
  • How to Test:
    • Black-Box: the existing idle-timeout test, plus the "increasing delays" probe moved over from SESS-06, under #### Idle Timeout. There's also a new #### Absolute Timeout test: keep the session active with periodic requests past a reasonable maximum lifetime, confirm re-authentication is required, and check the limit isn't tied to a client-controlled value (cookie Expires/Max-Age, JWT exp).
    • Gray-Box: dropped the two logout checks duplicated from SESS-06 and added idle/absolute server-side checks.
  • References: added the Session Management Cheat Sheet's Automatic Session Expiration section.

markdownlint-cli2 and the terminology textlint check pass on both files. Nothing else links to removed headings, and the checklist entries will pick up the new SESS-06/07 objectives on the next checklist publish.

Signed-off-by: enesbaldemir <enesbaldemir9538@gmail.com>
@kingthorin kingthorin added the revise Needs quality review, updates, or revision label Oct 30, 2026
@kingthorin kingthorin added this to the v5.0 Release milestone Oct 30, 2026
@kingthorin

Copy link
Copy Markdown
Collaborator

Here's some suggestions from Grok that seem worth addressing:


  • Absolute timeout practicality
    Step 3 says “Continue past a reasonable maximum lifetime … (see the Summary for typical values).” Summary only gives qualitative examples (“a few hours for a banking application or a working day for an internal business application”). Testers will often not know the configured absolute timeout. Consider a short note that:

    • if no absolute timeout is observed within a documented/reasonable window, record “no absolute timeout observed within X hours” rather than treating it as a hard fail, or
    • recommend checking configuration / session-store TTL when gray-box access is available.
  • Minor wording

    • SESS-07 Summary: “a working day for an internal business application .” — trailing space before the period.
    • Absolute Timeout step 4 could explicitly say the session must be invalidated server-side (same expectation as idle), not only that the UI asks for re-auth.
  • Tools
    Burp Repeater is linked inline for the absolute-timeout probe. SESS-06 already lists Burp Suite – Repeater under Tools; SESS-07 currently has no Tools section. Optional: add a minimal Tools section pointing at Repeater (and optionally a simple script) so the section is self-contained.

  • SSO interaction (optional note)
    Absolute timeout behaviour under SSO / federated sessions can differ from the local session. A brief note acknowledging that would be useful if it fits cleanly in the Summary or Absolute Timeout section.


@fzipi fzipi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review findings (Claude Code, high effort), checked against style_guide.md and template/.

3. Continue past a reasonable maximum lifetime for the application (see the Summary for typical values).
4. The application should eventually require the user to authenticate again, even though the session was never idle. If the session stays valid for as long as it keeps being used, no absolute timeout is enforced.

If the session lifetime appears to be tied to a value the client controls, such as the `Expires` or `Max-Age` attribute of a cookie or a timestamp inside a token (for example the `exp` claim of a [JSON Web Token](10-JSON_Web_Tokens.md)), check whether modifying it extends the session. As with the idle timeout, the limit must be enforced server-side.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new client-controlled-lifetime check tells testers to modify a cookie's Expires/Max-Age or a JWT exp claim and see whether the session is extended, but neither manipulation can produce the described result.

Cookie Expires/Max-Age are browser-side attributes that are never sent to the server, so editing them cannot extend a server-side session; the meaningful test is replaying the cookie value after its expiry time has passed. Editing exp in a correctly signed JWT just breaks the signature (401), which a tester following this text would misread as 'limit enforced server-side'; the real check is replaying the token after exp and probing the refresh-token lifetime. The idle paragraph at line 36 at least conditions this on 'if it's not cryptographically protected'; the new paragraph drops that caveat.


1. Log in and note the time.
2. Keep the session active by sending a request to an authenticated page at intervals shorter than the idle timeout, for example with [Burp Repeater](https://portswigger.net/burp/documentation/desktop/tools/repeater) or a simple script.
3. Continue past a reasonable maximum lifetime for the application (see the Summary for typical values).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Absolute Timeout black-box procedure has no stopping criterion and step 4 draws an absolute conclusion ('no absolute timeout is enforced') from a finite observation.

Step 3 says 'continue past a reasonable maximum lifetime (see the Summary)', but the Summary only offers 'a few hours' or 'a working day'. A tester who keeps the session alive for 6 hours cannot distinguish a 12-hour or 24-hour absolute timeout from none, yet the text instructs them to report that none is enforced. The step should state a concrete window and a hedged conclusion ('lifetime exceeds N hours') and point to the gray-box/config check for confirmation.

- The log out function effectively destroys all session token, or at least renders them unusable,
- The server performs proper checks on the session state, disallowing an attacker to replay previously destroyed session identifiers
- A timeout is enforced and it is properly enforced by the server. If the server uses an expiration time that is read from a session token that is sent by the client (but this is not advisable), then the token must be cryptographically protected from tampering.
- An idle timeout is enforced by the server, based on the time since the last request in the session.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gray-Box list drops the check that the server rejects replay of previously destroyed session identifiers, which for SESS-07 means expired (timed-out) IDs, not just logged-out ones.

The removed bullet 'The server performs proper checks on the session state, disallowing an attacker to replay previously destroyed session identifiers' was treated as a logout duplicate, but after an idle/absolute timeout fires it is the core SESS-07 gray-box check. The new list only verifies that timeouts exist and are server-based; an implementation that flags a session as expired yet still accepts the old ID on replay satisfies all three new bullets. Line 57 mentions invalidate()/abandon() but never states that expired IDs must be rejected.


- Availability of user interface controls that allow the user to manually log out.
- Session termination after a given amount of time without activity (session timeout).
- Session termination after a given amount of time without activity (session timeout), covered in [Session Timeout](07-Session_Timeout.md).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'secure session termination requires at least the following components' list still names only the inactivity timeout, while SESS-07 now states applications 'should also enforce an absolute timeout'.

The two sections now disagree on the required components: a reader of SESS-06 is told the minimum is a logout control, an idle timeout, and server-side invalidation, with no mention of the absolute lifetime limit that SESS-07 adds as a requirement in the same PR. Either the bullet should read 'automatic expiration (idle and absolute timeouts)' or point generically to SESS-07 without enumerating.

3. Continue past a reasonable maximum lifetime for the application (see the Summary for typical values).
4. The application should eventually require the user to authenticate again, even though the session was never idle. If the session stays valid for as long as it keeps being used, no absolute timeout is enforced.

If the session lifetime appears to be tied to a value the client controls, such as the `Expires` or `Max-Age` attribute of a cookie or a timestamp inside a token (for example the `exp` claim of a [JSON Web Token](10-JSON_Web_Tokens.md)), check whether modifying it extends the session. As with the idle timeout, the limit must be enforced server-side.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New paragraph re-implements the idle section's client-vs-server enforcement test (line 36) with slightly different wording instead of sharing one explanation.

Lines 36-38 already say: if the cookie carries time data, modify it and see whether the session is prolonged; everything must be checked server-side. Line 47 repeats this for the absolute case (cookie Expires/Max-Age, token timestamp, 'must be enforced server-side'), and the gray-box bullet at line 55 says it a third time. Two divergent copies of the same procedure will drift; a single 'Client vs. Server Enforcement' paragraph after both subsections covers both timeouts.

Some web application frameworks rely solely on the session cookie to identify the logged-on user. The user's ID is embedded in the (encrypted) cookie value. The application server does not do any tracking on the server-side of the session. When logging out, the session cookie is removed from the browser. However, since the application does not do any tracking, it does not know whether a session is logged out or not. So by reusing a session cookie it is possible to gain access to the authenticated session. A well-known example of this is the Forms Authentication functionality in ASP.NET.

Users of web browsers often don't mind that an application is still open and just close the browser or a tab. A web application should be aware of this behavior and terminate the session automatically on the server-side after a defined amount of time.
Users of web browsers often don't mind that an application is still open and just close the browser or a tab. A web application should be aware of this behavior and terminate the session automatically on the server-side after a defined amount of time. Testing for this is covered in [Session Timeout](07-Session_Timeout.md).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Summary now links to 07-Session_Timeout.md twice (line 14 and line 23) for the same purpose.

Issue #1586 asked for 'a one-line pointer to SESS-07'. Both the component bullet and the browser-close paragraph now end with 'covered in [Session Timeout]'; one of the two pointers is redundant, and the browser-close paragraph itself is timeout content that the PR's stated goal ('logout only') would move or drop.


All applications should implement an idle or inactivity timeout for sessions. This timeout defines the amount of time a session will remain active in case there is no activity by the user, closing and invalidating the session upon the defined idle period since the last HTTP request received by the web application for a given session ID. The most appropriate timeout should be a balance between security (shorter timeout) and usability (longer timeout) and heavily depends on the sensitivity level of the data handled by the application. For example, a 60 minute log out time for a public forum can be acceptable, but such a long time would be too much in a home banking application (where a maximum timeout of 15 minutes is recommended). In any case, any application that does not enforce a timeout-based log out should be considered not secure, unless such behavior is required by a specific functional requirement.

The idle timeout limits the chances that an attacker has to guess and use a valid session ID from another user, and under certain circumstances could protect public computers from session reuse. However, if the attacker is able to hijack a given session, the idle timeout does not limit the attacker’s actions, as he can generate activity on the session periodically to keep the session active for longer periods of time.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Third-person 'he' remains in the Summary paragraph directly above the inserted absolute-timeout paragraph, violating the style guide's Second Person rule, while the PR removed the equivalent 'him/her' two paragraphs below.

style_guide.md 'Second Person': 'Do not write in the first or third person, such as by using I or he.' Line 13 reads 'as he can generate activity on the session periodically'. The PR edited this Summary and deleted 'impersonate him/her' from it but left this instance; rewrite as 'as the attacker can generate activity'.


When either timeout expires, the session must be terminated in the same way as on log out: all session tokens (e.g. cookies) must be destroyed or made unusable server-side, so that they cannot be replayed to "resurrect" the session of a legitimate user. See [Logout Functionality](06-Logout_Functionality.md) for details.

The most common scenario for this kind of attack is a public computer that is used to access some private information (e.g., web mail, online bank account). If the user moves away from the computer without explicitly logging out and the session timeout is not implemented on the application, then an attacker could access to the same account by simply pressing the "back" button of the browser.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'The most common scenario for this kind of attack' has lost its antecedent after the surrounding paragraphs were rewritten and reordered.

Originally the sentence followed the full cookie-replay paragraph. It now follows the absolute-timeout, server-side-enforcement, and one-sentence replay paragraphs, and describes a public-computer/back-button scenario that is an idle-timeout concern. A reader takes 'this kind of attack' to mean the absolute-timeout/hijack case just introduced, which the public-computer example does not illustrate; the paragraph belongs after the idle-timeout paragraph (line 11) or should name the attack explicitly.

The idle timeout limits the chances that an attacker has to guess and use a valid session ID from another user, and under certain circumstances could protect public computers from session reuse. However, if the attacker is able to hijack a given session, the idle timeout does not limit the attacker’s actions, as he can generate activity on the session periodically to keep the session active for longer periods of time.

Session timeout management and expiration must be enforced server-side. If some data under the control of the client is used to enforce the session timeout, for example using cookie values or other client parameters to track time references (e.g. number of minutes since log in time), an attacker could manipulate these to extend the session duration. So the application has to track the inactivity time server-side and, after the timeout is expired, automatically invalidate the current user's session and delete every data stored on the client.
This is why applications should also enforce an absolute timeout, which limits the total lifetime of a session regardless of activity. Once it expires, the user has to authenticate again even if the session was never idle. Its value also depends on the sensitivity of the application, for example a few hours for a banking application or a working day for an internal business application.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recommended absolute-timeout values ('a few hours for a banking application') are unsourced and do not match the cited Session Management Cheat Sheet, which the Absolute Timeout step 3 then relies on as 'typical values'.

The cheat sheet section the PR links (#automatic-session-expiration) gives 4-8 hours for a full-day office application and no banking figure. The WSTG text invents 'a few hours' for banking and 'a working day' for internal apps, and step 3 (line 44) instructs testers to use these as pass/fail thresholds. Testers will flag an app with a 4-hour banking lifetime inconsistently depending on how they read 'a few'.

#### Absolute Timeout

1. Log in and note the time.
2. Keep the session active by sending a request to an authenticated page at intervals shorter than the idle timeout, for example with [Burp Repeater](https://portswigger.net/burp/documentation/desktop/tools/repeater) or a simple script.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Burp Repeater is referenced inline as 'Burp Repeater' while the sibling SESS-06 lists the same URL under a ## Tools section as 'Burp Suite - Repeater'; SESS-07 has no Tools section.

Every other section in this chapter that names a tool (01, 02, 03, 05, 06, 09, 10) also lists it under ## Tools. SESS-07 now names a tool but has no Tools section, and uses a different display name than SESS-06 for the identical link, so a reader scanning Tools sections for Burp usage will miss SESS-07 and the two sections will drift when the URL changes.

@kingthorin

Copy link
Copy Markdown
Collaborator

@enesbaldemir Feel feee to respond if you think any AI comments are off base.

Signed-off-by: enesbaldemir <enesbaldemir9538@gmail.com>
@enesbaldemir

Copy link
Copy Markdown
Contributor Author

@kingthorin I went through each point and they all looked valid to me, so I addressed all of them rather than pushing back on any.

Thanks for the thorough review, @fzipi! All points are addressed in the latest commit (8c534d4):

  • Replaced the cookie Expires/Max-Age and JWT exp modification test with replaying the captured cookie/token after expiry, plus a refresh-token check. Modifying a value is now only suggested for unprotected time data inside the cookie/token value.
  • Merged the duplicated client/server enforcement text into one Client-Side and Server-Side Enforcement subsection covering both timeouts.
  • Absolute timeout: added an agreed test window and a hedged conclusion ("still valid after N hours"), with confirmation via gray-box review.
  • Gray-box: restored the check that expired session IDs are rejected on replay.
  • SESS-06: the components list now mentions both idle and absolute timeouts. Removed the browser-close paragraph and the duplicate link (folded into the public computer scenario in SESS-07).
  • Fixed "he" → "the attacker", and moved the public computer paragraph so it follows the idle timeout text.
  • Absolute timeout values now follow the cheat sheet (4–8 hours for a full-day application).
  • Added a Tools section with Burp Suite - Repeater.

@enesbaldemir

Copy link
Copy Markdown
Contributor Author

@kingthorin The Grok suggestions are covered in the same commit as well: the absolute timeout test window and hedged conclusion, server-side invalidation in step 4, a gray-box check for the configured timeout values / session store TTL, the Tools section, and a short SSO note. The trailing space before the period wasn't present in the file.

@kingthorin

Copy link
Copy Markdown
Collaborator

Thanks!

I'll get back to it tomorrow (I hope).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

revise Needs quality review, updates, or revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove SESS-06/SESS-07 overlap and add absolute timeout testing

3 participants