Forum Discussion
Enhancing Web Server Security via F5 Cookie Hash Exposure
Mykola Uspalenko.
- Mykola
Altostratus
Additional Explanation:Building upon the earlier proposal, I want to provide further clarification on how the Hash-Sum can be utilized to enhance security:- Embedding Hash-Sum in Client Responses: After the web server receives the Hash-Sum from the F5 load balancer via the HTTP request headers, it should include this Hash-Sum in all forms, query responses, and AJAX outputs sent to the client. This can be done by embedding the Hash-Sum as a hidden field in forms, a parameter in URLs, or as part of the data payload in AJAX responses.- Client Returns Hash-Sum: When the client interacts with the web application—such as submitting a form, making a query request, or initiating an AJAX call—it will send the embedded Hash-Sum back to the web server as part of the request.- Server-Side Validation: Upon receiving the request, the web server compares the returned Hash-Sum with the expected value associated with the session. If the Hash-Sum matches, the server can proceed with processing the request. If there is a mismatch or the Hash-Sum has changed unexpectedly, it could indicate that the F5 has initiated a new session or that the request is potentially part of a CSRF attack.Why This Is Important:- Enhanced CSRF Protection: By requiring the client to return the Hash-Sum with each request, the web server adds an extra layer of validation. Since the Hash-Sum is tied to the session managed by the F5 load balancer, it becomes more difficult for attackers to forge valid requests without access to the correct Hash-Sum.- Session Integrity Monitoring: This method allows the web server to detect when a session has been unexpectedly altered or recreated by the F5 load balancer, which could be a sign of session hijacking or other malicious activities.- Minimal Client Impact: Since the Hash-Sum is managed transparently by the web server and included in responses sent to the client, there is no additional burden on the client's browser or the need for client-side scripting changes.Implementation Considerations:- Secure Transmission: Ensure that all communications between the client and server are secured using HTTPS to prevent interception of the Hash-Sum.- Hash-Sum Protection: The Hash-Sum should be treated as sensitive data. Avoid exposing it in URLs where it might be logged or cached. Using hidden form fields or secure cookies is preferable.- Session Synchronization: The web server must maintain synchronization with the F5 load balancer regarding session state. Any changes in the Hash-Sum should be carefully managed to prevent false positives in detecting CSRF attacks.- Fallback Mechanisms: In cases where the Hash-Sum might legitimately change (e.g., after a session timeout or load balancer failover), implement mechanisms to handle such scenarios gracefully without disrupting the user experience.By integrating this additional step into the proposal, the web server gains a robust method for verifying the legitimacy of client requests, thereby strengthening defenses against CSRF and related session-based attacks. - zamroni777
Nacreous
you can extract the client side f5 persistence cookie from http request then add it into custom http request header on server side using irules or local traffic policy.
i think the reason it is not default right now is backend web/app servers might not expect such extra request header/cookie and might treat such requests as faulty application requests. - Mykola
Altostratus
zamroni777, when a client makes an initial HTTP(s) request to the server, the F5 load balancer responds with a Set-Cookie header to set a persistent cookie. Are you saying that this persistent cookie is created by F5 in the first HTTP(s) request and can be passed to the server as a header by adding this irules or local traffic policy, even before the persistent cookie is sent to the client for the first time? This looks like a good solution, but needs to be tested. Thanks.
- zamroni777
Nacreous
the principal thing stays that client will only send persistence cookie in http requests after getting it in a previous http response.
so cookie value can only be read from second http request.however, you can override builtin f5 cookie insert mechanism using your own irules / traffic policies.
you can also use data from http response (session cookie, other http response header, data from http response payload, server ip addr and tcp port etc.) as source of persistence key
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