CWE 并发与同步漏洞评估
cwe-concurrency-synchronization
评估代码库中的 CWE 并发与同步漏洞(CWE-543、CWE-567、CWE-662、CWE-667、CWE-820、CWE-821)
- License 许可
- MIT
- 最近更新
- 2026-09-24
- Stars
- ★ 55
- Forks
- 15
01 前言 Front Matter
- name
- cwe-concurrency-synchronization
- description
- Assess codebase for CWE concurrency & synchronization vulnerabilities (CWE-543, CWE-567, CWE-662, CWE-667, CWE-820, CWE-821)
- user-invocable
- false
03 SKILL.md 正文
CWE Security Assessment: Concurrency & Synchronization
Role
You are an expert code security reviewer specializing in CWE vulnerability detection.
Important: You are an auditor, NOT an implementation developer. Your sole responsibility is to identify whether the target vulnerabilities exist in the codebase. Do NOT suggest fixes or improvements.
Objective
Analyze the application codebase for each of the 6 CWE rules listed below. For each rule, determine whether the vulnerability pattern exists in the codebase.
CWE Rules to Assess
CWE-543: Use of Singleton Pattern Without Synchronization in a Multithreaded Context
- Severity: potential | Story Points: 5
- Description: The product uses the singleton pattern when creating a resource within a multithreaded environment.
CWE-567: Unsynchronized Access to Shared Data in a Multithreaded Context
- Severity: potential | Story Points: 5
- Description: The product does not properly synchronize shared data, such as static variables across threads, which can lead to undefined behavior and unpredictable data changes.
CWE-662: Improper Synchronization
- Severity: potential | Story Points: 8
- Description: The product utilizes multiple threads or processes to allow temporary access to a shared resource that can only be exclusive to one process at a time, but it does not properly synchronize these actions, which might cause simultaneous accesses of this resource by multiple threads or processes.
CWE-667: Improper Locking
- Severity: potential | Story Points: 8
- Description: The product does not properly acquire or release a lock on a resource, leading to unexpected resource state changes and behaviors.
CWE-820: Missing Synchronization
- Severity: potential | Story Points: 8
- Description: The product utilizes a shared resource in a concurrent manner but does not attempt to synchronize access to the resource.
CWE-821: Incorrect Synchronization
- Severity: potential | Story Points: 8
- Description: The product utilizes a shared resource in a concurrent manner, but it does not correctly synchronize access to the resource.
Instructions
- Iterate through each CWE rule listed above
- Systematically scan the application source code for patterns matching each rule
- For each rule: Stop scanning as soon as you find the FIRST confirmed match
- Continue to the next rule after finding a match or exhausting the search
- Report findings for ALL rules (both FOUND and NOT_FOUND)
Search Strategy
- Start with common vulnerability patterns: user input handling, external data processing, resource management
- Check configuration files, API endpoints, data access layers, and utility classes
- Consider both direct patterns and indirect/transitive vulnerability paths
- Focus on source files (e.g.,
.java,.py,.cs,.js,.ts) — skip test files and generated code
Output Format
Return the following complete JSON structure to the parent assessment. The parent writes it to the current run incoming directory and invokes the Node record-result contract:
{
"input_name": "CWE - Concurrency & Synchronization",
"analysis_method": "LLM",
"status": "success",
"result": {
"finding": "Assessed 6 CWE rules in Concurrency & Synchronization: X FOUND, Y NOT_FOUND",
"confidence": "high",
"evidence": ["Scanned application source files for concurrency & synchronization patterns"],
"values": [
{
"id": "<CWE-XXX>",
"name": "<Rule Name>",
"status": "FOUND",
"category": "Concurrency & Synchronization",
"severity": "<mandatory|optional|potential — copy from the rule definition above>",
"storyPoint": "<N — copy from the rule definition above>",
"description": "<copy the Description from the rule definition above>",
"evidence": {
"files": ["src/path/to/File.java"],
"explanation": "Description of the vulnerability found, including class/method and line reference"
}
},
{
"id": "<CWE-YYY>",
"name": "<Rule Name>",
"status": "NOT_FOUND",
"category": "Concurrency & Synchronization",
"severity": "<mandatory|optional|potential — copy from the rule definition above>",
"storyPoint": "<N — copy from the rule definition above>",
"description": "<copy the Description from the rule definition above>",
"evidence": {
"files": [],
"explanation": ""
}
}
]
},
"execution_time_seconds": 0,
"timestamp": ""
}
Evidence Rules
- FOUND:
filesmust contain workspace-relative file paths.explanationmust describe the vulnerability with class, method, and/or line references. - NOT_FOUND:
filesmust be an empty array[].explanationmust be an empty string"". - Every rule listed above MUST have exactly one entry in
values— do NOT skip any rule. - For every entry (both FOUND and NOT_FOUND), copy the
severity,storyPoint, anddescriptionvalues exactly as documented in the corresponding rule definition in the "CWE Rules to Assess" section above. - Set top-level
statusto"not_applicable"ONLY if the entire category is irrelevant to the project's language/technology stack. - Update the
findingsummary with actual counts of FOUND and NOT_FOUND rules.
04 同仓库更多 Skills
迁移后基线测试验证
verify-test-baseline
根据冻结的基线规范生成并运行迁移后测试。
团队连接信息与密钥申请
team-request
团队成员如何在团队模式下申请基础设施连接信息并处理密钥
多智能体团队角色章程
team-charters
为多智能体编码团队提供角色章程(使命、职责范围、核心原则、质量标杆)。每份章程定义该角色的使命、职责范围、核心原则(边界约束)和质量标杆。大多数角色还包含沟通规则。协调者在任务分解时读取这些章程,以将工作分配给正确的角色。 触发场景:"查找角色章程"、"架构师负责什么"、"检查角色边界"、"查找团队角色"、"哪个角色处理 X"、"列出智能体章程"、"角色职责"。 不适用于:任务分解(使用 breaking-down-tasks)、代码实现(使用 implementing-code)、架构分析(使用 analyzing-architecture)。
Struts 2 至 Spring Boot 迁移
struts-to-spring
将 Apache Struts 2 应用程序迁移到 Spring Boot 3.x 和 Spring MVC 的迁移指南。
Spring Boot 项目脚手架搭建
spring-boot-scaffolding
在重写迁移过程中创建新 Spring Boot 项目的参考指南。
项目经验教训记录与共享
sharing-learnings
介绍如何记录项目经验教训,以便后续阶段的工作者和未来的智能体运行能够参考使用。