Skip to content

[Bug] pwda参数会覆盖内置密码本而非追加 #609

Closed

Description

@Wandering-y

问题模块

弱口令爆破 (Brute Force)

严重程度

功能异常 (Malfunction)

问题描述

根据官方文档说明,pwda参数表示:“额外密码,支持逗号或空格分隔多个值”
但是实际测试下来发现pwda参数会覆盖内置的密码本,如下
[root@centos ~]# /root/Scan/fscan_2.2.1_linux_x64 -h 10.225.137.23 -p 6379 -np -nocolor -nopg
┌──────────────────────────────────────────────┐
│ ___ _ │
│ / _ \ ___ ___ _ __ __ _ | | __ │
│ / /
/
/ |/ | '/ ` |/ __| |/ / │
│ / /
\
____
\ (__| | | (
| | (| < │
│ _
/ |/_|| _,|___||_\ │
└──────────────────────────────────────────────┘
Fscan 2.2.1 (95cc12e 2026-08-25T20:44:10Z)

[] 服务插件: redis, webtitle, webpoc
[
] 参数自适应: Timeout=1000ms, ModuleThread=30, Retry=1, ICMPRate=0.50, PocNum=30
[] 10.225.137.23:6379 redis [Product:Redis key-value store] Banner:(-NOAUTH Authentication required.)
[
] 扫描完成,发现 1 个开放端口
[!] Redis 10.225.137.23:6379 123456
[*] 扫描任务完成,耗时 3.014s,已扫描 1 个目标
[root@centos ~]# /root/Scan/fscan_2.2.1_linux_x64 -h 10.225.137.23 -p 6379 -np -nocolor -pwda abc qwe
┌──────────────────────────────────────────────┐
│ ___ _ │
│ / _ \ ___ ___ _ __ __ _ | | __ │
│ / /
/
/ |/ | '/ ` |/ __| |/ / │
│ / /
\
____
\ (__| | | (
| | (| < │
│ _
/ |/_|| _,|___||_\ │
└──────────────────────────────────────────────┘
Fscan 2.2.1 (95cc12e 2026-08-25T20:44:10Z)

[] 服务插件: redis, webpoc, webtitle
[
] 参数自适应: Timeout=1000ms, ModuleThread=30, Retry=1, ICMPRate=0.50, PocNum=30
[] 10.225.137.23:6379 redis [Product:Redis key-value store] Banner:(-NOAUTH Authentication required.)
[
] 扫描完成,发现 1 个开放端口
[-] 10.225.137.23:6379 redis 未发现弱密码
[*] 扫描任务完成,耗时 3.007s,已扫描 1 个目标
定位到config_builder.go,parsePasswords() 只收集 -pwd / -pwdf / -pwda 三个参数的值,全程没有引用内置字典:func parsePasswords(fv *FlagVars) ([]string, error) {
var passwords []string
// 命令行密码(支持逗号分隔多个值,保留空格作为密码的一部分)
if fv.Password != "" {
for _, p := range strings.Split(fv.Password, ",") {
p = strings.TrimSpace(p)
if p != "" {
passwords = append(passwords, p)
}
}
}

// 从文件读取
if fv.PasswordsFile != "" {
	if lines, err := parsers.ReadLinesFromFile(fv.PasswordsFile); err == nil {
		passwords = append(passwords, lines...)
	} else {
		return nil, fmt.Errorf("%s", i18n.Tr("config_read_passwords_failed", fv.PasswordsFile, err))
	}
}

// 额外密码
if fv.AddPasswords != "" {
	passwords = append(passwords, splitCredentialValues(fv.AddPasswords)...)
}

return removeDuplicate(passwords), nil

}
parseCredentials()拿到结果后,直接整体覆盖cfg.Credentials.Passwords
func parseCredentials(fv *FlagVars, cfg *Config) error {
...
// 解析密码
passwords, err := parsePasswords(fv)
if err != nil {
return err
}
if len(passwords) > 0 {
cfg.Credentials.Passwords = passwords
}
...
}
而 cfg.Credentials.Passwords 本来是有内容的,由 flag_config.go 的 BuildConfigFromFlags() 初始化:
Credentials: CredentialConfig{
Userdict: cloneStringSliceMap(config.DefaultUserDict),
Passwords: cloneStringSlice(config.DefaultPasswords),
UserPassPairs: nil,
...
}

复现步骤

找一个密码是123456的redis测试一下即可
/root/Scan/fscan_2.2.1_linux_x64 -h 10.225.137.23 -p 6379
/root/Scan/fscan_2.2.1_linux_x64 -h 10.225.137.23 -p 6379 -pwda abc qwe

错误输出

fscan 版本

2.2.0

操作系统

CentOS 7/8/Stream

系统架构

amd64 (x86_64)

补充信息

版本是2.2.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions