Forum Discussion
Replay Attack prevention for HTTP Post of Auth details
I have an application (let's call it website 1) which users log into using a username and password. Once logged in the app sends back a simple landing page with some links, and in hidden fields it inserts a clear text username and password for website 2. This second set of credentials is not seen or known by the user. When the user clicks to access their account details this performs a POST of their secondary auth details to website 2, it responds with their account details in another webpage and the user is now happily using website 2 without knowing what went on. All of this happens through one BigIP with website 1 and website 2 sitting on the same domain name.
We now want to secure this whole process by preventing the username and password being in cleartext and ideally prevent a replay attack where a host based packet sniffer/malware could capture the POST data and simply replay to log into website 2 in the future.
I'm thinking of the following plan:
To prevent clear text auth details:-
=========================
1) Scrub the username/password hidden field values on the way back to the customer and place their values in encrypted session cookies. When the POST is sent back, decryot the cookies and insert the values back into the POST payload and it all works fine.
To prevent replay attacks:-
===================
2) Somehow validate the POST containing the encrypted auth cookies to ensure that the submission is only valid for that session/period of time.
For 1) I have worries about performance of regexing the payload and the complexity of the irule required.
For 2) I don't know how I can do this. Is there a way to use a variable that is session based or time based that could either be used as an encryption key or as something else to check, so that replaying the same POST another day would not be valid.
Appreciate any thoughts,
thanks
Carl
- JRahm
Admin
quick question...how deep into the payload is the username/password, and is its location consistent? Also, does the POST need to occur more than once? - Carl_Gottlieb_1
Nimbostratus
Hi, - JRahm
Admin
what version of TMOS are you running? - Carl_Gottlieb_1
Nimbostratus
9.4.8 - JRahm
Admin
This is totally doable. You'd need to have an iRule on each virtual. First virtual iRule would collect payload and search/replace the user/password. Take the username/password, hash it, send the hash to the user in an encrypted cookie and store the credentials in the session table locally. The second virtual's iRule would then lookup the hash in the session table, format the request with the username/password in appropriate fields for the request, then delete the session table entry. No entry, no replay. Obviously, there is work to do on your part, but there is a solution, and if you get stuck, post back. - Carl_Gottlieb_1
Nimbostratus
Thanks! In this case both apps actually would sit on the same domain name and behind the same virtual server so this could be done in one iRule I suppose. - JRahm
Admin
take a look at the persistence section here: http://devcentral.f5.com/wiki/default.aspx/iRules/CodeShare.html Click Here - Carl_Gottlieb_1
Nimbostratus
Here's the working iRule. - JRahm
Admin
nice work, sir!
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com