{"record":{"id":"06bb0808699e46a3","repo":"shadow1ng/fscan","slug":"redis-ping-failed","errorCode":null,"errorMessage":"redis_ping_failed","messagePattern":"redis_ping_failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"plugins/services/redis.go","lineNumber":173,"sourceCode":"\t_ = conn.SetReadDeadline(time.Now().Add(timeout))\n\tresponse := make([]byte, 512)\n\tn, pingReadErr := conn.Read(response)\n\tif pingReadErr != nil {\n\t\t_ = conn.Close()\n\t\treturn &AuthResult{\n\t\t\tSuccess:   false,\n\t\t\tErrorType: ErrorTypeNetwork,\n\t\t\tError:     pingReadErr,\n\t\t}\n\t}\n\n\tresponseStr := string(response[:n])\n\tif !strings.Contains(responseStr, \"PONG\") {\n\t\t_ = conn.Close()\n\t\treturn &AuthResult{\n\t\t\tSuccess:   false,\n\t\t\tErrorType: ErrorTypeUnknown,\n\t\t\tError:     fmt.Errorf(\"%s\", i18n.Tr(\"redis_ping_failed\", strings.TrimSpace(responseStr))),\n\t\t}\n\t}\n\n\treturn &AuthResult{\n\t\tSuccess:   true,\n\t\tConn:      conn,\n\t\tErrorType: ErrorTypeUnknown,\n\t\tError:     nil,\n\t}\n}\n\n// classifyRedisErrorType Redis错误分类\nfunc classifyRedisErrorType(err error) ErrorType {\n\tif err == nil {\n\t\treturn ErrorTypeUnknown\n\t}\n\n\tredisAuthErrors := []string{","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/redis.go#L155-L191","documentation":"After connecting and authenticating the handshake to a Redis server, the plugin sends a PING and expects a reply containing \"PONG\". If the raw response bytes do not contain PONG, it closes the connection and fails the auth attempt with redis_ping_failed, embedding the actual response text via i18n.Tr. This guards against servers that accept TCP on 6379 but do not speak RESP correctly (proxies, honeypots, HTTP endpoints, or a server requiring AUTH that returns an error string instead of PONG).","triggerScenarios":"doRedisAuth connects to a Redis port, completes its handshake, sends PING, and the response string does not contain \"PONG\" — e.g. the server returned \"-NOAUTH Authentication required\", \"-ERR unknown command\", an HTTP error page, or garbage bytes.","commonSituations":"Redis protected-mode or ACLs rejecting unauthenticated PING; the port actually hosts a different service (memcached, an HTTP proxy, a honeypot); a RESP-incompatible middleware in front of Redis; scanning a non-Redis service that happens to listen on 6379.","solutions":["Check the actual response text embedded in the error to see what the server returned.","If it is -NOAUTH, provide correct Redis credentials before the PING (set the password in the auth config).","Verify the target is really Redis: run redis-cli -h <host> -p <port> PING manually.","Confirm protected-mode is disabled or the scanner source IP is allowed (bind/ACL settings in redis.conf)."],"exampleFix":"// before (server returns -NOAUTH)\nconn.Write([]byte(\"PING\\r\\n\")) // -> \"-NOAUTH Authentication required.\"\n// after\nconn.Write([]byte(\"AUTH mypassword\\r\\n\"))\nconn.Write([]byte(\"PING\\r\\n\")) // -> \"+PONG\"","handlingStrategy":"try-catch","validationCode":"conn, err := net.DialTimeout(\"tcp\", host+\":6379\", 3*time.Second)\nif err == nil {\n    fmt.Fprintf(conn, \"PING\\r\\n\")\n    buf := make([]byte, 64)\n    n, _ := conn.Read(buf)\n    if !strings.Contains(string(buf[:n]), \"PONG\") { /* expect redis_ping_failed; inspect raw response */ }\n    conn.Close()\n}","typeGuard":"func isPong(resp string) bool { return strings.Contains(resp, \"PONG\") }","tryCatchPattern":"res, err := plugin.Scan(ctx, target)\nif err != nil {\n    var ae *AuthResult\n    if strings.Contains(err.Error(), \"-NOAUTH\") {\n        // supply credentials and retry\n    } else {\n        log.Printf(\"redis probe not a real Redis server: %v\", err)\n    }\n}","preventionTips":["Always preflight with redis-cli PING before scanning a target as Redis.","Include a valid credential pair so AUTH precedes PING.","Filter out ports whose banner does not look like RESP before dispatching to the redis module."],"tags":["redis","network","protocol-handshake","brute-force"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}