Skip to content

Arthur Aipov yaml - #590

Closed
ArthurAipov wants to merge 6 commits into
adeyosemanputra:masterfrom
Retr0-46:ArthurAipov-YAML
Closed

ArthurAipov wants to merge 6 commits into
adeyosemanputra:masterfrom
Retr0-46:ArthurAipov-YAML

Conversation

@ArthurAipov

Copy link
Copy Markdown

Summary

Completed Lab 5 DevSecOps individual assignment: analyzed unsafe YAML deserialization vulnerability (Bandit B506, CWE-502) in PyGoat application with full security assessment, CVSS scoring, and code remediation (bonus).

Problem / Motivation

Lab 5 requires each student to select an individual vulnerability from SAST scan results and perform comprehensive security analysis. Selected B506 (yaml_load) to avoid duplication with existing reports (eval injection, path traversal). This vulnerability allows remote code execution through malicious YAML files.

Fixes # (not applicable - lab assignment)

Solution / Approach

Core Requirements:

  • Analyzed unsafe YAML deserialization in dockerized_labs/a9_uckv_lab/app.py:62
  • Classified as CWE-502 (Deserialization of Untrusted Data)
  • Calculated CVSS v3.1 score: 9.8 (Critical) with vector string
  • Documented impact (RCE, file access, environment disclosure) and required privileges

Bonus:

  • Replaced yaml.load(Loader=yaml.Loader) with yaml.safe_load()
  • Added input validation and error handling
  • Verified fix with Bandit: 1 Medium issue → 0 issues
  • Created proof-of-concept demonstrating RCE with malicious YAML payloads

Files Changed

File Change
COMPLETION_CHECKLIST.md Full requirements checklist with completion status
LAB5_SOLUTION.md Project overview and deliverables summary
reports/yaml_deserialization/report.md Main vulnerability analysis (CWE, CVSS, impact, recommendations)
reports/yaml_deserialization/BONUS_FIX_VERIFICATION.md Code remediation documentation with before/after
reports/yaml_deserialization/app_vulnerable.py Original vulnerable code extracted for analysis
reports/yaml_deserialization/app_fixed.py Fixed code with safe_load() and validation
reports/yaml_deserialization/demo_vulnerability.py Executable PoC demonstrating RCE
reports/yaml_deserialization/test_*.yaml Safe and malicious YAML test files
reports/yaml_deserialization/bandit-*.txt Bandit scan reports (before/after comparison)
reports/yaml_deserialization/bandit-full.json Full Bandit scan results in JSON format

Type of Change

  • Documentation update
  • Security fix
  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • CI/CD or build configuration

Impact

  • Security: Documented critical RCE vulnerability (CVSS 9.8) with working exploit demonstration
  • Code Quality: Provided secure implementation using yaml.safe_load() that blocks malicious payloads
  • Verification: Bandit confirms vulnerability elimination (1 issue → 0 issues after fix)
  • Documentation: 1300+ lines covering CWE classification, CVSS assessment, impact analysis, and remediation
  • Educational: Complete proof-of-concept allows understanding attack mechanics and defense effectiveness

Screenshots (if applicable)

N/A - Security analysis and code remediation (no UI changes)

Verification

Run the demonstration:

cd reports/yaml_deserialization
python3 demo_vulnerability.py

Retr0-46 and others added 6 commits November 20, 2026 11:31
Добавил в reports/task4/ отчёт на английском в Markdown и PDF, результат Bandit B307 и два скриншота локальной проверки. Разобрал CWE-95, CVSS, последствия и необходимые права атакующего.

Моя находка — eval() в /lab2, command_injection_lab/app.py:49. Для своих разборов выберите другие уязвимости. Markdown можно использовать при сборке общего отчёта.
Analyzed unsafe YAML deserialization vulnerability (Bandit B506) in PyGoat
application with complete security assessment and code remediation.

Vulnerability Details:
- Type: Unsafe YAML Deserialization (CWE-502)
- Bandit Rule: B506 (yaml_load)
- Location: dockerized_labs/a9_uckv_lab/app.py:62
- CVSS: 9.8 (Critical) / 8.8 (High with authentication)
- Impact: Remote Code Execution (RCE)

Deliverables:
✓ Full vulnerability analysis with CWE-502 classification
✓ CVSS v3.1 assessment: 9.8 / CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
✓ Impact analysis and privilege assessment
✓ Complete technical documentation

Bonus (Code Remediation):
✓ Code fix: yaml.load() → yaml.safe_load() + validation
✓ Bandit verification: 1 Medium issue → 0 issues
✓ Proof-of-concept demonstration with live RCE examples
✓ Type validation and improved error handling
✓ Full verification documentation

Files:
- 7 markdown documentation files (1300+ lines)
- 2 source code files (vulnerable + fixed versions)
- 4 proof-of-concept and test files
- 3 Bandit scan reports (JSON and text format)

Total: 16 files + images directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants