Implement replay attack mitigation for SAML auth.

Review Request #12476 — Created July 18, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

SAML is generally quite secure by design, but if there's a man in the
middle, it is susceptible to replay attacks (within a short limited time
frame). The way this is mitigated is by giving every message and
assertion a unique ID. The service provider can then store these IDs and
make sure that they haven't already been used.

This change implements that. The used IDs are kept in the cache, and
checked before we proceed. While using the cache for this isn't 100%
reliable, given the very short message lifetime, it's good enough for
our purposes.

  • Ran unit tests.
  • Verified that I could still log in with SAML.
  • Crafted a replay and saw that it was successfully blocked.

Diff Revision 4 (Latest)

orig
1
2
3
4

Commits

First Last Summary ID Author
Implement replay attack mitigation for SAML auth.
SAML is generally quite secure by design, but if there's a man in the middle, it is susceptible to replay attacks (within a short limited time frame). The way this is mitigated is by giving every message and assertion a unique ID. The service provider can then store these IDs and make sure that they haven't already been used. This change implements that. The used IDs are kept in the cache, and checked before we proceed. While using the cache for this isn't 100% reliable, given the very short message lifetime, it's good enough for our purposes. Testing Done: - Ran unit tests. - Verified that I could still log in with SAML. - Crafted a replay and saw that it was successfully blocked. Reviewed at https://reviews.reviewboard.org/r/12476/
d2a809773ca78f6fc3ebd1360bb521711c33b842 David Trowbridge
reviewboard/accounts/sso/backends/saml/views.py
reviewboard/accounts/tests/test_saml_views.py
Loading...