... って実装されています。 セッションの機能を有効にするには、次のように設定を行います。 MIDDLEWARE 設定を編集し 'django.contrib.sessions.middleware.SessionMiddleware' を含むようにする。 django-admin startproject で作られるデフォルトの settings.py は SessionM ... iddleware が有効化されています。 セッションを使いたくない場合は、 MIDDLEWARE 内の SessionMiddleware 行と INSTALLED_APPS 内の 'django.contrib.sessions' を削除しても構いません。これで、オーバーヘッドが少しだけ短縮さ ... れます。 セッションエンジンを設定する デフォルトでは、Django はセッションを、( django.contrib.sessions.models.Session モデルを用いて) データベースに保存します。これは便利ですが、セットアップによってはセッションのデータを他の ... ... ession storage anytime request.session was accessed and there was a session key provided in the request cookies that didn't already have a session record. This c ... ould allow an attacker to easily create many new session records simply by sending repeated requests with unknown session keys, potentially filling up the session store or causing ... other users' session records to be evicted. The built-in session backends now create a session record only if the session is actually modified; ... ... the session storage anytime request.session was accessed and there was a session key provided in the request cookies that didn't alrea ... dy have a session record. This could allow an attacker to easily create many new session records simply by sending repeated requests with un ... known session keys, potentially filling up the session store or causing other users' session records to be evicted. The built-in session ... ... ts the session key to an empty string rather than None . An empty string is treated as a valid session key and the session cookie is set ... accordingly. Any users with an empty string in their session cookie will use the same session store. session.flush() is called by django.contrib.auth.logout() and, more seriously, by ... ) when a user switches accounts. If a user is logged in and logs in again to a different account (without logging out) the session is flushed to avoid reuse. After the session is flushed (and its session key becomes '' ) the account details are set on t ... ... ed it wasn't decorated with login_required() as done in the admin). This could allow an attacker to easily create many new session records by sending repeated requests, potentially filling up the session store or causing other users' session records to ... be evicted. The SessionMiddleware has been modified to no longer create empty session records, including when SESSION_SAVE_EVERY_REQUEST is active ... . Additionally, the contrib.sessions.backends.base.SessionBase.flush() and cache_db.SessionStore.flush() methods have been modified to avoid creating a new em ... ... backwards compatibility, RemovedInDjango20Warning remains as an importable alias. Denial-of-service possibility by filling session store In previous versions of Django, the session backends created a new empty record in the session storage anytime reque ... st.session was accessed and there was a session key provided in the request cookies that didn't already have a session record. This c ... ould allow an attacker to easily create many new session records simply by sending repeated requests with unknown session keys, potentially filling up the session store or causing ... ... ersions of pip. Denial-of-service possibility in logout() view by filling session store Previously, a session could be created when anonymously accessing the django.contrib.auth.views.logout() view (provi ... ed it wasn't decorated with login_required() as done in the admin). This could allow an attacker to easily create many new session records by sending repeated requests, potentially filling up the session store or causing other users' session records to ... be evicted. The SessionMiddleware has been modified to no longer create empty session records, including when SESSION_SAVE_EVERY_REQUEST is active ... ... er-controlled variable, but it's possible in principle. Mitigating a remote-code execution vulnerability in django.contrib.sessions django.contrib.sessions currently uses pickle to serialize session data before storing it in the backend. If you're using ... the signed cookie session backend and SECRET_KEY is known by an attacker (there isn't an inherent vulnerability in Django that would cause it to lea ... k), the attacker could insert a string into their session which, when unpickled, executes arbitrary code on the server. The technique for doing so is simple and easily available on ... ... ed it wasn't decorated with login_required() as done in the admin). This could allow an attacker to easily create many new session records by sending repeated requests, potentially filling up the session store or causing other users' session records to ... be evicted. The SessionMiddleware has been modified to no longer create empty session records, including when SESSION_SAVE_EVERY_REQUEST is active ... ... g on FILE_UPLOAD_MAX_MEMORY_SIZE . This issue has severity "low" according to the Django security policy . CVE-2026-35192: Session fixation via public cached pages and SESSION_SAVE_EVERY_REQUEST Response headers did not vary on cookies if a session was ... not modified, but SESSION_SAVE_EVERY_REQUEST was True . A remote attacker could steal a user's session after that user visits a cached public page. ... 2026年10月08日