UDP port scanner is missing SNMP ports
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
- 领域
- networking, security
调研方向
从 build.rs 开始,检查捆绑的 SNMP probe 所使用的 payload 解码,然后针对 demo.pysnmp.com 运行提供的 snmpget 和 RustScan 命令。验证字面文本、转义序列和相邻的带引号字符串是否按描述进行解码,并确认 UDP 端口 161 是否通过公共 SNMP 服务被检测到。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
Rustscan cannot find an open SNMP port, while it can be found using NMAP and snmpget.
To Reproduce
-
Confirm that the public SNMP test service responds using SNMPv1 and community
public:snmpget -v1 -c public -t 3 -r 1 \ demo.pysnmp.com 1.3.6.1.2.1.1.1.0Observed:
SNMPv2-MIB::sysDescr.0 = STRING: #SNMP Agent on .NET Standard -
Scan UDP port 161 using Nmap:
sudo nmap -sU -Pn -n -p 161 --reason \ --max-retries 1 --host-timeout 20s demo.pysnmp.comObserved with Nmap 7.95:
PORT STATE SERVICE REASON 161/udp open snmp udp-response ttl 63 -
Scan the same port using an affected RustScan build:
rustscan --no-config --udp -a demo.pysnmp.com -p 161 \ --timeout 3000 --tries 2 --scripts none --accessibleObserved with the affected RustScan 2.4.1 lab build:
Looks like I didn't find any open ports for 128.203.82.143.
Expected behavior
RustScan should generate a valid SNMP payload containing the community string public and detect UDP port 161 when the agent responds.
More generally, payload decoding should preserve literal text, decode escape sequences, and concatenate quoted strings without adding separator whitespace.
Screenshots
Not applicable;
Desktop (please complete the following information):
- OS: Linux/aarch64 for the containerized comparison; macOS/Apple Silicon for an additional host check.
- Browser: Not applicable.
- Version: RustScan 2.4.1 in downstream lab builds; installed host RustScan 2.3.0 also missed the port.
- Nmap: 7.95 for the comparison.
Smartphone (please complete the following information):
- Device: Not applicable.
- OS: Not applicable.
- Browser: Not applicable.
- Version: Not applicable.
Additional context
According to our friend 🤖
The missing detection appears to be caused by a malformed SNMP payload. The server does not respond to that payload, so RustScan reports no open ports.
The parser in build.rs keeps only ASCII hexadecimal digits:
if char == '\' && payload.chars().nth(idx + 1) == Some('x') {
continue;
} else if char.is_ascii_hexdigit() {
tmp_str.push(char);
// Converts each pair of retained hex digits into a byte.
}
However, the bundled SNMP probe contains the literal community string public. The parser retains only b and c, converting the six-character string into the single byte 0xbc.
This produces a 28-byte probe instead of the expected 33 bytes, while its BER header still declares 31 bytes after the two-byte header.
A local build with corrected payload decoding detected port 161 on the same server. The faulty parser is also present in upstream master at the time of reporting.
Other probes containing literal text, including NetBIOS, LDAP, SSDP, memcached, and service location, may be affected as well.
- 主要语言
- Rust
- 星标
- 20.6k
- 派生
- 1.4k
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 14
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bee-san/RustScan 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
bee-san/RustScan#937 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 38/100
bee-san/RustScan#825 · 7 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 42/100
bee-san/RustScan#822 · 1 个 reaction ·
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 58/100
bee-san/RustScan#795 · 1 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
Support for port range input like `1-22,661-669,8888` for both CLI and library usage可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
bee-san/RustScan#780 · 4 条评论 ·
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 3 天内回复
-
Zellij doesn't validate hex colors correctly and crashes可能已有人在做 @ymcx 今天认领。 未关闭suspected bug
难度 2/5 1-3 小时 新手友好度 76/100
zellij-org/zellij#5732 ·
维护者通常 1 天内回复
-
bug rust
难度 2/5 1-3 小时 新手友好度 78/100
jonathanong/no-mistakes#2267 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
rust-embedded/cortex-m#702 · 1 条评论 ·
-
Make major, minor, and makedev safe on solarish targets可能已有人在做 @xtqqczze 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复