The Django documentation on its CSRF protection states that:
In addition, for HTTPS requests,
strict referer checking is done by
CsrfViewMiddleware. This is necessary
to address a Man-In-The-Middle attack
that is possible under HTTPS when
using a session independent nonce, due
to the fact that HTTP ‘Set-Cookie’
headers are (unfortunately) accepted
by clients that are talking to a site
under HTTPS. (Referer checking is not
done for HTTP requests because the
presence of the Referer header is not
reliable enough under HTTP.)
I have trouble visualizing how this attack works. Could somebody explain?
UPDATE:
The wording in the Django doc seems to imply that there is a specific type of man-in-the-middle attack (which leads to a successful CSRF I’d assume) that works with session independent nonce (but not with transaction specific nonce etc., I suppose) and involves the use of ‘Set-Cookie’ header.
So I wanted to know how that specific type of attack works.
Directly from the django project
(I googled for session independent nonce.)