4D Component which includes methods to help your web developing.
I have not tried this scenario and do not confirm if it’s realizable. However it seems to work in theory.
80 to the local fake web server.http://target-site/beacon.gif.http://target-site but it will be handled by the fake web server.HTTPS, the web client will send the session ID that is set by the attacker. Since the session ID was generated by the real site, the target site accepts it.This issue occurs because the unsafe session ID is tied to the authenticated user session. To prevent this, generate another session ID after login is established and use it for evaluating user authentication. Since the attacker does not know the newly generated session ID, the attack will not take effect.
Of course the newly generated session ID must be sent to the user’s web client under SSL/TLS connection, and also set the secure flag to prevent from sniffing.
// after a user is autheticated
$sessionId_t:=Generate UUID
WEB SET HTTP HEADER("Set-Cookie: CookieName="+$sessionId_t+"; Secure; HttpOnly; SameSite=Lax")
$auth_o:=New object
$auth_o.sessionId:=$sessionId_t
$auth_o.user:=$userEntity_o // authenticated user entity
Use(Session.storage.auth) // assumes Session.storage.auth shared object exists
Session.storage.auth:=OB Copy($auth_o; ck shared; Session.storage.auth)
End use
when the next request comes, extract the cookie value whose name is CookieName, then compare it with the value of Session.storage.auth.sessionId using exact match.
$authenticated_b:=(Compare strings(Session.storage.auth.sessionId; $cookieValue_t; sk char codes)=0)