Regarding man-in-the-middle attacks
Please note, that hijacking a foreign user session is perfectly possible if your site uses the HTTP
protocol.
To protect against session hijacking attacks, you need to enable
HTTPs.
HTTP transfers the data related to requests and replies as simple text (not encrypted).
Since the session ID is either kept in a cookie or in URLs (please don't use that option!), a MITM attacked simply reads out the session ID. Then, the MITM attacker sets the session ID cookie in his browser and owns the other user's identify.
To get a session ID, the MITM needs a privileged location regarding the client's network route to a server system. The attacker either needs to sit in-between the client system and the server system. Or it needs to sit in the client's network and mimic to be the default router of the client system.
Regarding the session issues
What value does modx' system property session_handler_class has?
If it is the default value modSessionHandler
, modx uses database
managed session. Leave the setting blank to instruct modx to enable
standard PHP session handling.
Regarding cache issues
Caching typically persists and retrieves data sent to the client, e.g. HTML-code. Typically, you won't find cookies in cached files.
If an anonymous user X suddenly get's the session cookie of another logged-in user, modx needs to somehow find the other user's session.
If the session IDs are non-trivial long, it's quite unlikely to guess
a session ID of another user. Likewise, it's very unlikely to grab the
persisted session data of another user.
... unless modx somehow iterates through the set of all persisted sessions - instead of just grabbing the correct persisted session file.
Therefore: Lookout for search operation within the session handling of modx.
Trace execution using PHP's tick feature
As a very last resort, you might enable PHP's tick feature:
Do this at the beginning of your app (e.g. in index.php):
declare(ticks=1);
register_tick_function('traceStatements', true);
Then, define the tick function:
function traceStatements() {
$traceInfo = debug_backtrace();
// Use $traceInfo to identify the last method called
// Trace the method to a central log file
// Create a new log file per incoming http request
}
Using this code traceStatements()
get's called at each executing PHP statement. You might use this mechanism to prepare several traces of different client requests - and compare each other.
Have a look here for some trace code, which might be of help.