Friday, 20 June 2025

CWE and CVE


             

CWE and CVE are both security identifiers but they serve different purposes. Let me give you a simple analogy and then a technical example.”

Analogy:
Think of CWE as a type of disease, like “flu” or “diabetes.” It tells you the category of the issue.
Now, CVE is like a specific patient’s case – “John Doe caught the flu on May 1st.” It’s a real incident with a timestamp and impact.

Technical Example:
Let's say there’s a CVE:
👉 CVE-2021-44228 – This was the Log4Shell vulnerability in Apache Log4j. It allowed attackers to execute remote code just by logging a specific string.

This CVE maps to multiple CWEs, such as:
👉 CWE-20: Improper Input Validation
👉 CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

So:

  • The CVE is the real-world issue that was discovered, exploited, and patched.

  • The CWEs tell you why that CVE happened — in this case, due to poor input validation and injection flaws.

In practice, I use CVEs to track and patch known issues in software we use, and I use CWEs during secure code reviews, static analysis, and developer training to prevent these issues from occurring in the first place. 


Feature 

CVE (Common Vulnerabilities and Exposures) 

CWE (Common Weakness Enumeration) 

Purpose 

Catalog of specific real-world vulnerabilities 

Catalog of types or categories of weaknesses 

Use Case 

Used to track and identify known issues in specific software 

Used to classify the root cause or pattern of the vulnerability 

Example 

CVE-2024-3094 – A backdoor in XZ Utils 

CWE-78 – OS Command Injection 

Maintained by 

MITRE Corporation 

MITRE Corporation 

Level 

Instance-level (what happened) 

Concept-level (why it happened) 

Used for 

Patching, remediation, vendor advisories 

Secure coding, static analysis, training 



🔗 How They Work Together

A CVE often maps to one or more CWEs.

For example:

  • CVE-2024-XXXX — describes a real attack in Apache

  • CWE-79 — explains that the vulnerability is caused by Cross-Site Scripting (XSS)


When to Use What 

Scenario 

Use CVE? 

Use CWE? 

You want to check if a library has known bugs 

 

 

You're teaching developers secure coding 

 

 

You're doing penetration testing or patching 

 

✅ (as reference) 

You're building a static code analysis tool 

 

 

 


🔐 What is a CVSS Score?

CVSS stands for Common Vulnerability Scoring System.

It is a standardized way to measure the severity of security vulnerabilities and is widely used in vulnerability management, risk assessment, and patch prioritization.



_______________________________________________________________


🔐 1. CVE, CWE, CVSS – In Practice

TopicWhy It Matters
CVEIdentify and track real-world software vulnerabilities
CWEUnderstand root causes and prevent them in code
CVSSAssess how dangerous a vulnerability is and prioritize response

📦 2. Vulnerability Management Lifecycle

A security engineer should know this end-to-end process:

  1. Asset Inventory – Know what software/hardware you have.

  2. Vulnerability Scanning – Use tools like:

    • Nessus, Qualys, OpenVAS for networks

    • Trivy, Grype for containers

    • AWS Inspector, Azure Defender for cloud

  3. Detection – Find CVEs and misconfigurations.

  4. Prioritization – Use CVSS, business criticality, and exploitability.

  5. Remediation/Mitigation – Patch, block, or isolate.

  6. Validation – Verify the fix worked.

  7. Reporting & Metrics – Dashboards for compliance and leadership.


🧰 3. Security Tools You Should Know

AreaTools
Vulnerability ScanningNessus, Qualys, OpenVAS, Trivy
Container SecurityAqua, Prisma, Grype
Cloud SecurityAWS Inspector, Prowler, ScoutSuite, CloudSploit
SBOM / Supply ChainSyft, Anchore, Snyk
Threat FeedsOSV, CISA KEV, MITRE ATT&CK, VirusTotal

📋 4. Patch & Risk Management

  • Use Patch Management Systems: WSUS, SCCM, Tanium, Ansible.

  • Use Risk-based prioritization:

    • CVSS > 8.0?

    • Exploits available?

    • Exposed to the internet?

    • Business impact if compromised?


⚙️ 5. Integration with DevSecOps

Security Engineers should:

  • Integrate CVE scanning into CI/CD pipelines.

  • Use GitHub/GitLab/Snyk/OWASP Dependency-Check to scan libraries.

  • Block deployments with known critical vulnerabilities.


🛡️ 6. Mapping CVEs to MITRE ATT&CK

  • Learn how to map CVEs to ATT&CK techniques to understand attacker behavior and improve threat detection.

  • Example: CVE-2021-44228 → T1190 (Exploit Public-Facing Application)


📚 7. Regulatory & Compliance Requirements

  • Understand how CVEs relate to frameworks like:

    • NIST 800-53 / 800-171

    • ISO 27001

    • SOC 2

    • PCI-DSS

  • Many require timely remediation of vulnerabilities with CVSS >7.

    ______________________________________________



🛠️ Step-by-Step: How to Map CVEs to MITRE ATT&CK

✅ Step 1: Understand the CVE

  • Example: CVE-2021-44228 (Log4Shell)

  • Description: Remote code execution in Log4j via user-controlled input

  • Attack vector: Remote, over HTTP/log data


✅ Step 2: Identify the Exploit Method

  • What does the attacker achieve?

    • Remote Code Execution

    • Via input injection

    • No authentication required


✅ Step 3: Match to MITRE ATT&CK Techniques

Use ATT&CK Tactics → Techniques:

  • Tactic: Initial Access, Execution

  • Technique(s):

    • 🔹 T1190Exploit Public-Facing Application

    • 🔹 T1059Command and Scripting Interpreter

    • 🔹 T1203Exploitation for Client Execution

🔗 Reference: https://attack.mitre.org/


✅ Step 4: Cross-Check with External Sources

Use these platforms/tools:

Tool / SourceDescription
ATT&CK NavigatorInteractive tool to overlay CVEs to ATT&CK
VulnCAT (by Fortify)Maps CVEs to CWEs → ATT&CK
CISA Known Exploited Vulnerabilities CatalogLists real-world exploited CVEs with ATT&CK context
Mandiant / Red Canary / Threat reportsThreat actors + CVE + ATT&CK techniques

🧩 Example Mapping Table

CVEExploit DescriptionMITRE ATT&CK Technique(s)
CVE-2021-44228RCE via Log4j JNDI injectionT1190, T1059
CVE-2017-0144SMB RCE (EternalBlue)T1210 (Exploitation of Remote Services), T1059
CVE-2018-11776Apache Struts RCET1190, T1203
CVE-2020-1472Zerologon – Netlogon privilege escalationT1068 (Exploitation for Privilege Escalation), T1078 (Valid Accounts)

📈 Bonus: How to Use This in Detection Engineering

Use CaseExample
SIEMWrite detection rule for T1190 based on abnormal POST requests to known vulnerable endpoints
Threat HuntingHunt for base64-encoded payloads in logs mapped to T1059
MITRE CoverageTrack which techniques your detection rules already cover using MITRE Navigator overlays

✅ Pro Tip for Interview

"I map CVEs to MITRE ATT&CK techniques to understand how attackers would exploit them, which helps me write better detections and prioritize remediation. For instance, when Log4Shell (CVE-2021-44228) emerged, I mapped it to T1190 and T1059, and then verified our EDR coverage against those techniques."


No comments:

Post a Comment