MCPcopy Create free account
hub / github.com/F-Stack/f-stack / securityWarningCommand

Function securityWarningCommand

app/redis-6.2.6/src/networking.c:3060–3069  ·  view source on GitHub ↗

This callback is bound to POST and "Host:" command names. Those are not * really commands, but are used in security attacks in order to talk to * Redis instances via HTTP, with a technique called "cross protocol scripting" * which exploits the fact that services like Redis will discard invalid * HTTP headers and will process what follows. * * As a protection against this attack, Redis will t

Source from the content-addressed store, hash-verified

3058 * when a POST or "Host:" header is seen, and will log the event from
3059 * time to time (to avoid creating a DOS as a result of too many logs). */
3060void securityWarningCommand(client *c) {
3061 static time_t logged_time;
3062 time_t now = time(NULL);
3063
3064 if (llabs(now-logged_time) > 60) {
3065 serverLog(LL_WARNING,"Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis. This is likely due to an attacker attempting to use Cross Protocol Scripting to compromise your Redis instance. Connection aborted.");
3066 logged_time = now;
3067 }
3068 freeClientAsync(c);
3069}
3070
3071/* Keep track of the original command arguments so that we can generate
3072 * an accurate slowlog entry after the command has been executed. */

Callers

nothing calls this directly

Calls 1

freeClientAsyncFunction · 0.85

Tested by

no test coverage detected