fix: bind Redis to 127.0.0.1 to prevent exposure in host network mode#1893
Open
kamjin3086 wants to merge 1 commit intounclecode:mainfrom
Open
fix: bind Redis to 127.0.0.1 to prevent exposure in host network mode#1893kamjin3086 wants to merge 1 commit intounclecode:mainfrom
kamjin3086 wants to merge 1 commit intounclecode:mainfrom
Conversation
When running with network_mode: host (common for transparent proxy setups like daed), the bundled Redis server listens on 0.0.0.0 by default, exposing it to the entire network without authentication. This change adds --bind 127.0.0.1 to the redis-server command, ensuring Redis is only accessible from localhost. The application already connects to Redis via localhost:6379, so this has zero impact on functionality. Security impact: - Prevents unauthenticated Redis access from external networks - Critical for users deploying with network_mode: host - No breaking changes — app connects to localhost regardless
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--bind 127.0.0.1to the bundledredis-servercommand indeploy/docker/supervisord.confnetwork_mode: host(common for transparent proxy setups like daed), Redis was listening on0.0.0.0by default, exposing it to the entire network without any authenticationlocalhost:6379, so this change has zero impact on functionalityProblem
The Crawl4AI Docker image bundles a Redis server managed by supervisord. When users deploy with
network_mode: host(which is the recommended approach for transparent proxy compatibility), the Redis server binds to0.0.0.0:6379by default. This means:password: ""in config.yml)CONFIG SET dir/CONFIG SET dbfilenameis a well-documented exploitation pathI discovered this on my own server after noticing 19,000+ SSH brute-force attempts coming through an frp tunnel — while investigating, I found Redis was also wide open on
0.0.0.0:6379.Solution
One-line change in
deploy/docker/supervisord.conf:Why this is safe
server.pyconnects to Redis vialocalhost:6379(line 211-212)127.0.0.1IS localhost — the application works identicallyconfig.ymlAlternative approaches considered
--bind 127.0.0.1(this PR)requirepassnetwork_mode: hostTesting
Verified on a live deployment with
network_mode: host:Thanks for building such a great tool — this was discovered during a security audit of my own deployment. Hope this helps other users avoid the same pitfall!