vulnerability-scanner

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Vulnerability Scanner

漏洞扫描器

Think like an attacker, defend like an expert. 2025 threat landscape awareness.
像攻击者一样思考,像专家一样防御。洞悉2025年威胁态势。

🔧 Runtime Scripts

🔧 运行时脚本

Execute for automated validation:
ScriptPurposeUsage
scripts/security_scan.py
Validate security principles applied
python scripts/security_scan.py <project_path>
执行以实现自动化验证:
脚本用途使用方法
scripts/security_scan.py
验证已应用的安全原则
python scripts/security_scan.py <project_path>

📋 Reference Files

📋 参考文件

FilePurpose
checklists.mdOWASP Top 10, Auth, API, Data protection checklists

文件用途
checklists.mdOWASP Top 10、身份验证、API、数据保护检查清单

1. Security Expert Mindset

1. 安全专家思维模式

Core Principles

核心原则

PrincipleApplication
Assume BreachDesign as if attacker already inside
Zero TrustNever trust, always verify
Defense in DepthMultiple layers, no single point
Least PrivilegeMinimum required access only
Fail SecureOn error, deny access
原则应用场景
Assume Breach(假设已遭入侵)按攻击者已进入系统的前提进行设计
Zero Trust(零信任)永不信任,始终验证
Defense in Depth(纵深防御)多层防护,无单点故障
Least Privilege(最小权限)仅授予所需的最小访问权限
Fail Secure(安全失败)出错时拒绝访问

Threat Modeling Questions

威胁建模问题

Before scanning, ask:
  1. What are we protecting? (Assets)
  2. Who would attack? (Threat actors)
  3. How would they attack? (Attack vectors)
  4. What's the impact? (Business risk)

扫描前,请思考:
  1. 我们要保护什么?(资产)
  2. 谁会发起攻击?(威胁行为者)
  3. 他们会如何攻击?(攻击向量)
  4. 影响是什么?(业务风险)

2. OWASP Top 10:2025

2. OWASP Top 10:2025

Risk Categories

风险类别

RankCategoryThink About
A01Broken Access ControlWho can access what? IDOR, SSRF
A02Security MisconfigurationDefaults, headers, exposed services
A03Software Supply Chain 🆕Dependencies, CI/CD, build integrity
A04Cryptographic FailuresWeak crypto, exposed secrets
A05InjectionUser input → system commands
A06Insecure DesignFlawed architecture
A07Authentication FailuresSession, credential management
A08Integrity FailuresUnsigned updates, tampered data
A09Logging & AlertingBlind spots, no monitoring
A10Exceptional Conditions 🆕Error handling, fail-open states
排名类别思考要点
A01Broken Access Control(访问控制失效)谁可以访问什么?IDOR、SSRF
A02Security Misconfiguration(安全配置错误)默认配置、请求头、暴露的服务
A03Software Supply Chain 🆕(软件供应链)依赖项、CI/CD、构建完整性
A04Cryptographic Failures(密码学失败)弱加密、暴露的密钥
A05Injection(注入攻击)用户输入→系统命令
A06Insecure Design(不安全设计)存在缺陷的架构
A07Authentication Failures(身份验证失败)会话、凭证管理
A08Integrity Failures(完整性失败)未签名的更新、被篡改的数据
A09Logging & Alerting(日志与告警)监控盲区、无监控机制
A10Exceptional Conditions 🆕(异常情况)错误处理、故障开放状态

2025 Key Changes

2025年关键变化

2021 → 2025 Shifts:
├── SSRF merged into A01 (Access Control)
├── A02 elevated (Cloud/Container configs)
├── A03 NEW: Supply Chain (major focus)
├── A10 NEW: Exceptional Conditions
└── Focus shift: Root causes > Symptoms

2021 → 2025 变化:
├── SSRF 并入 A01(访问控制)
├── A02 优先级提升(云/容器配置)
├── A03 新增:供应链(重点关注)
├── A10 新增:异常情况
└── 重心转移:根源 > 症状

3. Supply Chain Security (A03)

3. 供应链安全(A03)

Attack Surface

攻击面

VectorRiskQuestion to Ask
DependenciesMalicious packagesDo we audit new deps?
Lock filesIntegrity attacksAre they committed?
Build pipelineCI/CD compromiseWho can modify?
RegistryTyposquattingVerified sources?
向量风险思考问题
依赖项恶意包我们是否审核新依赖?
锁定文件完整性攻击是否已提交锁定文件?
构建流水线CI/CD 被攻陷谁可以修改流水线?
注册表仿冒包攻击是否使用已验证的源?

Defense Principles

防御原则

  • Verify package integrity (checksums)
  • Pin versions, audit updates
  • Use private registries for critical deps
  • Sign and verify artifacts

  • 验证包完整性(校验和)
  • 固定版本,审核更新
  • 对关键依赖使用私有注册表
  • 签名并验证制品

4. Attack Surface Mapping

4. 攻击面映射

What to Map

映射内容

CategoryElements
Entry PointsAPIs, forms, file uploads
Data FlowsInput → Process → Output
Trust BoundariesWhere auth/authz checked
AssetsSecrets, PII, business data
类别元素
入口点API、表单、文件上传
数据流输入 → 处理 → 输出
信任边界进行身份验证/授权的位置
资产密钥、PII、业务数据

Prioritization Matrix

优先级矩阵

Risk = Likelihood × Impact

High Impact + High Likelihood → CRITICAL
High Impact + Low Likelihood  → HIGH
Low Impact + High Likelihood  → MEDIUM
Low Impact + Low Likelihood   → LOW

风险 = 可能性 × 影响

高影响 + 高可能性 → 严重(CRITICAL)
高影响 + 低可能性  → 高(HIGH)
低影响 + 高可能性  → 中(MEDIUM)
低影响 + 低可能性   → 低(LOW)

5. Risk Prioritization

5. 风险优先级排序

CVSS + Context

CVSS + 上下文

FactorWeightQuestion
CVSS ScoreBase severityHow severe is the vuln?
EPSS ScoreExploit likelihoodIs it being exploited?
Asset ValueBusiness contextWhat's at risk?
ExposureAttack surfaceInternet-facing?
因素权重思考问题
CVSS 评分基础严重程度漏洞的严重程度如何?
EPSS 评分被利用的可能性该漏洞是否正在被利用?
资产价值业务上下文面临风险的是什么?
暴露程度攻击面是否面向互联网?

Prioritization Decision Tree

优先级决策树

Is it actively exploited (EPSS >0.5)?
├── YES → CRITICAL: Immediate action
└── NO → Check CVSS
         ├── CVSS ≥9.0 → HIGH
         ├── CVSS 7.0-8.9 → Consider asset value
         └── CVSS <7.0 → Schedule for later

是否正在被主动利用(EPSS >0.5)?
├── 是 → 严重(CRITICAL):立即处理
└── 否 → 检查 CVSS
         ├── CVSS ≥9.0 → 高(HIGH)
         ├── CVSS 7.0-8.9 → 结合资产价值判断
         └── CVSS <7.0 → 安排后续处理

6. Exceptional Conditions (A10 - New)

6. 异常情况(A10 - 新增)

Fail-Open vs Fail-Closed

故障开放 vs 故障关闭

ScenarioFail-Open (BAD)Fail-Closed (GOOD)
Auth errorAllow accessDeny access
Parsing failsAccept inputReject input
TimeoutRetry foreverLimit + abort
场景故障开放(不良)故障关闭(良好)
身份验证错误允许访问拒绝访问
解析失败接受输入拒绝输入
超时无限重试限制重试次数并终止

What to Check

检查要点

  • Exception handlers that catch-all and ignore
  • Missing error handling on security operations
  • Race conditions in auth/authz
  • Resource exhaustion scenarios

  • 捕获所有异常并忽略的异常处理器
  • 安全操作缺失错误处理
  • 身份验证/授权中的竞争条件
  • 资源耗尽场景

7. Scanning Methodology

7. 扫描方法论

Phase-Based Approach

分阶段方法

1. RECONNAISSANCE
   └── Understand the target
       ├── Technology stack
       ├── Entry points
       └── Data flows

2. DISCOVERY
   └── Identify potential issues
       ├── Configuration review
       ├── Dependency analysis
       └── Code pattern search

3. ANALYSIS
   └── Validate and prioritize
       ├── False positive elimination
       ├── Risk scoring
       └── Attack chain mapping

4. REPORTING
   └── Actionable findings
       ├── Clear reproduction steps
       ├── Business impact
       └── Remediation guidance

1. RECONNAISSANCE(侦察)
   └── 了解目标
       ├── 技术栈
       ├── 入口点
       └── 数据流

2. DISCOVERY(发现)
   └── 识别潜在问题
       ├── 配置审查
       ├── 依赖分析
       └── 代码模式搜索

3. ANALYSIS(分析)
   └── 验证并排序优先级
       ├── 排除误报
       ├── 风险评分
       └── 攻击链映射

4. REPORTING(报告)
   └── 可执行的发现结果
       ├── 清晰的复现步骤
       ├── 业务影响
       └── 修复指导

8. Code Pattern Analysis

8. 代码模式分析

High-Risk Patterns

高风险模式

PatternRiskLook For
String concat in queriesInjection
"SELECT * FROM " + user_input
Dynamic code executionRCE
eval()
,
exec()
,
Function()
Unsafe deserializationRCE
pickle.loads()
,
unserialize()
Path manipulationTraversalUser input in file paths
Disabled securityVarious
verify=False
,
--insecure
模式风险检查要点
查询中的字符串拼接注入攻击
"SELECT * FROM " + user_input
动态代码执行远程代码执行(RCE)
eval()
,
exec()
,
Function()
不安全的反序列化远程代码执行(RCE)
pickle.loads()
,
unserialize()
路径操作路径遍历文件路径中包含用户输入
禁用安全机制各类风险
verify=False
,
--insecure

Secret Patterns

密钥模式

TypeIndicators
API Keys
api_key
,
apikey
, high entropy
Tokens
token
,
bearer
,
jwt
Credentials
password
,
secret
,
key
Cloud
AWS_
,
AZURE_
,
GCP_
prefixes

类型标识
API 密钥
api_key
,
apikey
, 高熵值
令牌
token
,
bearer
,
jwt
凭证
password
,
secret
,
key
云服务
AWS_
,
AZURE_
,
GCP_
前缀

9. Cloud Security Considerations

9. 云安全注意事项

Shared Responsibility

共享责任模型

LayerYou OwnProvider Owns
Data
Application
OS/RuntimeDependsDepends
Infrastructure
层级您负责服务商负责
数据
应用
操作系统/运行时视情况而定视情况而定
基础设施

Cloud-Specific Checks

云专属检查项

  • IAM: Least privilege applied?
  • Storage: Public buckets?
  • Network: Security groups tightened?
  • Secrets: Using secrets manager?

  • IAM:是否应用了最小权限原则?
  • 存储:是否存在公共存储桶?
  • 网络:安全组是否已收紧?
  • 密钥:是否使用密钥管理器?

10. Anti-Patterns

10. 反模式

❌ Don't✅ Do
Scan without understandingMap attack surface first
Alert on every CVEPrioritize by exploitability + asset
Ignore false positivesMaintain verified baseline
Fix symptoms onlyAddress root causes
Scan once before deployContinuous scanning
Trust third-party deps blindlyVerify integrity, audit code

❌ 不要做✅ 应该做
未理解目标就扫描先映射攻击面
对每个CVE都发出告警按可利用性+资产价值排序优先级
忽略误报维护已验证的基线
仅修复症状解决根源问题
仅在部署前扫描一次持续扫描
盲目信任第三方依赖验证完整性,审核代码

11. Reporting Principles

11. 报告原则

Finding Structure

发现结果结构

Each finding should answer:
  1. What? - Clear vulnerability description
  2. Where? - Exact location (file, line, endpoint)
  3. Why? - Root cause explanation
  4. Impact? - Business consequence
  5. How to fix? - Specific remediation
每个发现结果应回答:
  1. 是什么? - 清晰的漏洞描述
  2. 在哪里? - 精确位置(文件、行号、端点)
  3. 为什么? - 根源解释
  4. 影响? - 业务后果
  5. 如何修复? - 具体的修复建议

Severity Classification

严重程度分类

SeverityCriteria
CriticalRCE, auth bypass, mass data exposure
HighData exposure, privilege escalation
MediumLimited scope, requires conditions
LowInformational, best practice

Remember: Vulnerability scanning finds issues. Expert thinking prioritizes what matters. Always ask: "What would an attacker do with this?"
严重程度判定标准
严重(CRITICAL)远程代码执行(RCE)、身份验证绕过、大规模数据泄露
高(HIGH)数据泄露、权限提升
中(MEDIUM)范围有限,需特定条件触发
低(LOW)信息性内容,最佳实践建议

注意: 漏洞扫描用于发现问题。专家思维用于确定哪些问题至关重要。始终要问:“攻击者会利用这个漏洞做什么?”