Opened 3 weeks ago

Last modified 2 weeks ago

#37440 assigned Cleanup/optimization

Clarify directory permission requirements for file-based sessions

Reported by: Sarah Boyce Owned by: mudassar
Component: contrib.sessions Version: 6.1
Severity: Normal Keywords: not-security
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The file-based session backend includes the session ID in each session filename.
Hence, local users who can list the session directory can recover session IDs and could hijack authenticated sessions, even if they cannot read the files.
When SESSION_FILE_PATH is unset, Django uses the system’s temporary directory, which may be accessible to other local users.

The documentation currently mentions ensuring that the web server can read and write to the directory, but does not explain the need to restrict access by other users. The following docs should/could be updated to highlight this:

Note that Django treats session storage as a trusted component, similar to the database and cache storage. Restricting access to that storage by untrusted local users is the deployer’s responsibility. Thank you "you yang" for the report.

Change History (4)

comment:1 by David Smith, 2 weeks ago

Triage Stage: Unreviewed → Accepted

comment:2 by mudassar, 2 weeks ago

Owner: set to mudassar
Status: new → assigned

comment:3 by mudassar, 2 weeks ago

Has patch: set
Note: See TracTickets for help on using tickets.
Back to Top