新聞中心
警惕:Redis默認(rèn)1234端口存在安全漏洞

創(chuàng)新互聯(lián)是創(chuàng)新、創(chuàng)意、研發(fā)型一體的綜合型網(wǎng)站建設(shè)公司,自成立以來公司不斷探索創(chuàng)新,始終堅持為客戶提供滿意周到的服務(wù),在本地打下了良好的口碑,在過去的十載時間我們累計服務(wù)了上千家以及全國政企客戶,如發(fā)電機(jī)維修等企業(yè)單位,完善的項目管理流程,嚴(yán)格把控項目進(jìn)度與質(zhì)量監(jiān)控加上過硬的技術(shù)實力獲得客戶的一致稱揚。
Redis是一款非常流行的鍵值對數(shù)據(jù)庫,廣泛應(yīng)用于緩存、實時數(shù)據(jù)分析、消息隊列等場景。然而,在使用Redis時我們也需要注意到其默認(rèn)1234端口存在安全漏洞。本文將介紹該漏洞的原理和防范措施。
漏洞原理:
Redis的默認(rèn)端口為6379,但是它也支持其他端口的使用。當(dāng)在未授權(quán)的情況下,通過Redis的1234端口進(jìn)行訪問時,會收到如下提示:
NOAUTH Authentication required.
這表明該端口是需要進(jìn)行身份驗證的,但是如果沒有進(jìn)行身份驗證,我們?nèi)匀豢梢垣@取服務(wù)器的信息、配置、數(shù)據(jù)等敏感信息。以下為相關(guān)代碼:
$ telnet 127.0.0.1 1234
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
NOAUTH Authentication required.
INFO
# Server
redis_version:6.2.1
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:0f16cb34c58f1d5c
redis_mode:standalone
os:Linux 4.4.0-148-generic x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:5.4.0
process_id:25972
run_id:690a8c9961de91f091d21e3967df2b9318b9547f
tcp_port:6379
uptime_in_seconds:14
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:2093900
executable:/usr/bin/redis-server
config_file:
# Clients
connected_clients:1
client_recent_max_input_buffer:2
client_recent_max_output_buffer:0
blocked_clients:0
# memory
used_memory:424
used_memory_human:424B
used_memory_rss:434176
used_memory_rss_human:424.07KB
used_memory_peak:424
used_memory_peak_human:424B
used_memory_peak_perc:100.00%
used_memory_overhead:384
used_memory_startup:858552
used_memory_dataset:40
used_memory_dataset_perc:100.00%
allocator_allocated:496
allocator_active:512
allocator_resident:16384
total_system_memory:8227379712
total_system_memory_human:7.67G
used_memory_lua:0
used_memory_lua_human:0B
used_memory_scripts:0
used_memory_scripts_human:0B
number_of_cached_scripts:0
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:1.03
allocator_frag_bytes:16
allocator_rss_ratio:0.03
allocator_rss_bytes:15872
rss_overhead_ratio:0.03
rss_overhead_bytes:16384
mem_fragmentation_ratio:1022.05
mem_fragmentation_bytes:433752
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:0
mem_AOF_buffer:0
mem_allocator:libc
active_defrag_running:0
lazyfree_pending_objects:0
# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1621998795
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:0
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:0
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
aof_last_cow_size:0
module_fork_in_progress:0
module_fork_last_cow_size:0
# Stats
total_connections_received:1
total_commands_processed:1
instantaneous_ops_per_sec:0
total_net_input_bytes:28
total_net_output_bytes:444
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
rejected_commands:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:172
migrate_cached_sockets:0
# Replication
role:master
connected_slaves:0
master_replid:3f04c4aa4a4b9eafb24658d0ab2a7bba5b5bb5b5
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
# CPU
used_cpu_sys:0.022178
used_cpu_user:0.019325
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000
# Cluster
cluster_enabled:0
# Keyspace
db0:keys=3,expires=0,avg_ttl=0
如上所示,未授權(quán)的訪問者可以查看到該Redis服務(wù)器的所有運行狀態(tài),甚至可以進(jìn)行字符型操作。而這顯然是不安全的。
防范措施:
防范Redis的安全問題,主要可以從以下幾點來考慮:
1. 修改Redis端口號:我們可以指定Redis默認(rèn)的端口號,以免更改默認(rèn)端口造成的不便。例如,修改成夫20799端口:
# vim redis.conf
port 20799
2. 設(shè)置Redis密碼:我們可以為Redis設(shè)置一個旁人無法破解的密碼,這樣就可以保證訪問者無法訪問我們的Redis服務(wù)器。
# vim redis.conf
requirepass yourredispassword
設(shè)置完密碼之后我們就需要通過驗證才能查看到服務(wù)器的信息了:
$ telnet 127.0.0.1 20799
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
AUTH yourredispassword
+OK
INFO
...
以上就是關(guān)于警惕Redis默認(rèn)1234端口存在安全漏洞的一些介紹和注意事項。我們需要時刻關(guān)注Redis的安全問題,并進(jìn)行合理的防范。
香港服務(wù)器選創(chuàng)新互聯(lián),2H2G首月10元開通。
創(chuàng)新互聯(lián)(www.cdcxhl.com)互聯(lián)網(wǎng)服務(wù)提供商,擁有超過10年的服務(wù)器租用、服務(wù)器托管、云服務(wù)器、虛擬主機(jī)、網(wǎng)站系統(tǒng)開發(fā)經(jīng)驗。專業(yè)提供云主機(jī)、虛擬主機(jī)、域名注冊、VPS主機(jī)、云服務(wù)器、香港云服務(wù)器、免備案服務(wù)器等。
新聞名稱:警惕Redis默認(rèn)1234端口存在安全漏洞(redis端口號漏洞)
分享URL:http://m.fisionsoft.com.cn/article/dhcjidh.html


咨詢
建站咨詢
