mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
fix: 外部审查 8 项修复 + 国密 TLS 按需回退
- UserAgent 默认值回退 + 注册 -ua flag (#2) - README 编译命令 main.go → . (#3) - README 版本号同步 rc.1 (#4) - Client.go gmtls stdout 劫持删除 (#5) - ms17010 smb1GetResponse size<32 越界 panic (#6) - SSH 拨号超时统一 ModuleTimeout (#8) - AddPorts 死字段删除 (#9) - 国密 TLS 按需回退:标准 TLS 握手失败时仅在错误为 cipher/protocol 不兼容时尝试国密,跳过超时/拒绝等连接级错误
This commit is contained in:
@@ -198,6 +198,10 @@ func smb1GetResponse(conn net.Conn) ([]byte, *smbHeader, error) {
|
||||
sizeBuf := make([]byte, 4)
|
||||
copy(sizeBuf[1:], buf[1:])
|
||||
size := int(binary.BigEndian.Uint32(sizeBuf))
|
||||
// 畸形响应(size < SMB 头长度)会导致后续 buf[:smbHeaderSize] 越界 panic
|
||||
if size < smbHeaderSize {
|
||||
return nil, nil, fmt.Errorf("SMB1 response too short: %d bytes", size)
|
||||
}
|
||||
// SMB
|
||||
buf = make([]byte, size)
|
||||
_, err = io.ReadFull(conn, buf)
|
||||
|
||||
@@ -118,7 +118,7 @@ func (p *SSHPlugin) doSSHAuth(ctx context.Context, info *common.HostInfo, cred C
|
||||
}
|
||||
|
||||
// 建立TCP连接
|
||||
conn, err := session.DialTCP(ctx, "tcp", target, config.Timeout)
|
||||
conn, err := session.DialTCP(ctx, "tcp", target, moduleTimeout)
|
||||
if err != nil {
|
||||
return &AuthResult{
|
||||
Success: false,
|
||||
@@ -277,7 +277,7 @@ func (p *SSHPlugin) scanWithKey(ctx context.Context, info *common.HostInfo, sess
|
||||
func (p *SSHPlugin) identifyService(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
target := info.Target()
|
||||
|
||||
conn, err := session.DialTCP(ctx, "tcp", target, session.Config.Timeout)
|
||||
conn, err := session.DialTCP(ctx, "tcp", target, session.Config.ModuleTimeout())
|
||||
if err != nil {
|
||||
return &ScanResult{
|
||||
Success: false,
|
||||
|
||||
Reference in New Issue
Block a user