Files
skills/public/security-vulnerability-assessment.html
zeekayandHanzo Dev 9e10c1c10e Each llms index points at the other two
hanzoskills.com/llms.txt now opens with the install line, the API
reference index and the company index, so an agent that lands on any
one of the three can find the rest.

robots.txt claimed 537 documents while llms.txt counts 920. The number
is gone from robots.txt; llms.txt derives it.

public/ is regenerated from scripts/site.py, which it had fallen
behind: the copy-prompt menu and agent bar were in the generator and
not in the committed pages. tests/site.mjs passes against the result.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-11 00:27:59 -07:00

836 lines
38 KiB
HTML

<!doctype html>
<html lang="en"><head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>security-vulnerability-assessment</title>
<meta name="color-scheme" content="dark">
<style>
/* Committed to one visual world: a dark instrument panel. No light variant โ€”
the dot field and the hairline rules only read on black, and a naive
inversion would wash both out. Every colour is painted explicitly so the page
never borrows a host background. */
@font-face{font-family:'Zen';src:url('/fonts/Zen-Variable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:'Zen';src:url('/fonts/Zen-Italic-Variable.woff2') format('woff2');font-weight:100 900;font-style:italic;font-display:swap}
@font-face{font-family:'Zen Mono';src:url('/fonts/ZenMono-Variable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:'Zen Mono';src:url('/fonts/ZenMono-Italic-Variable.woff2') format('woff2');font-weight:100 900;font-style:italic;font-display:swap}
@font-face{font-family:'Zen Pixel Square';src:url('/fonts/ZenPixel-Square.woff2') format('woff2');font-style:normal;font-display:swap}
:root{
--ink:#f4f4f2; --soft:#9c9c98; --faint:#6a6a66; --ground:#000; --panel:#0a0a0a;
--line:#232323; --line-hi:#3a3a3a; --accent:#f4f4f2;
--font-zen-sans:'Zen',-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
--font-zen-mono:'Zen Mono',ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
--font-zen-pixel-square:'Zen Pixel Square',monospace;
--mono:var(--font-zen-mono);
--sans:var(--font-zen-sans);
/* Controls are pills and surfaces are soft, as on hanzo.ai. */
--r:999px; --r-soft:14px;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--sans);
font-size:16px;line-height:1.65;-webkit-font-smoothing:antialiased}
.wrap{max-width:60rem;margin:0 auto;padding:0 1.75rem}
/* The dot field. A halftone made of one repeating radial-gradient, faded out
along the diagonal by a mask so it reads as a wave rather than wallpaper. */
/* No overflow clip here: the dot field is inset to the box already, and a clip
would cut off the copy-prompt menu. */
.hero{position:relative;border-bottom:1px solid var(--line)}
.hero::before{content:"";position:absolute;inset:0;
background-image:radial-gradient(var(--line-hi) 1px, transparent 1px);
background-size:7px 7px;
-webkit-mask-image:linear-gradient(115deg,#000 0%,rgba(0,0,0,.55) 38%,transparent 72%);
mask-image:linear-gradient(115deg,#000 0%,rgba(0,0,0,.55) 38%,transparent 72%);
pointer-events:none}
.hero .wrap{position:relative;padding-top:5.5rem;padding-bottom:4rem}
nav{border-bottom:1px solid var(--line)}
nav .in{max-width:60rem;margin:0 auto;padding:1.1rem 1.75rem;display:flex;
justify-content:space-between;align-items:center;gap:1rem}
.brand{font-family:var(--mono);font-size:.85rem;letter-spacing:.14em;
text-transform:uppercase;color:var(--ink);text-decoration:none;
display:inline-flex;align-items:center;gap:.6rem}
.brand i{font-style:normal;color:var(--faint)}
.mark{width:1.15em;height:1.15em;display:block;flex:0 0 auto}
nav a.up{font-family:var(--mono);font-size:.72rem;letter-spacing:.14em;
text-transform:uppercase;color:var(--soft);text-decoration:none}
nav a.up:hover{color:var(--ink)}
h1{font-family:var(--mono);font-size:clamp(2rem,5.4vw,3.4rem);line-height:1.12;
letter-spacing:-.02em;margin:0 0 1.1rem;font-weight:500;text-wrap:balance}
h1 em{font-style:normal;color:var(--faint)}
.lede{color:var(--soft);font-size:1.05rem;max-width:52ch;margin:0 0 2.25rem}
.btns{display:flex;flex-wrap:wrap;gap:.7rem;margin:0 0 .5rem;align-items:center}
.btn{display:inline-flex;align-items:center;gap:.5rem;font-family:var(--mono);
font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;
padding:.8rem 1.4rem;border:1px solid var(--line-hi);border-radius:var(--r);
color:var(--ink);text-decoration:none;background:transparent;cursor:pointer;
line-height:1.2;font-weight:400}
.btn:hover{background:#141414;text-decoration:none;border-color:var(--soft)}
.btn.solid{background:var(--ink);color:#000;border-color:var(--ink)}
.btn.solid:hover{background:#d8d8d4}
.btn .chev{width:.7em;height:.7em;flex:0 0 auto;transition:transform .15s ease}
.btn[aria-expanded="true"] .chev{transform:rotate(180deg)}
/* Copy-prompt selector. Each row copies the prompt for its own target. */
.copy{position:relative;display:inline-flex}
.menu{position:absolute;top:calc(100% + .5rem);left:0;z-index:20;min-width:21rem;
background:var(--panel);border:1px solid var(--line-hi);border-radius:var(--r-soft);
padding:.4rem;display:flex;flex-direction:column;
box-shadow:0 12px 32px rgba(0,0,0,.75)}
.menu[hidden]{display:none}
.mi{display:flex;align-items:center;gap:.7rem;width:100%;text-align:left;
padding:.62rem .8rem;border:0;border-radius:calc(var(--r-soft) - .35rem);
background:transparent;color:var(--ink);font-family:var(--mono);font-size:.76rem;
letter-spacing:.04em;text-decoration:none;cursor:pointer;line-height:1.3;
white-space:nowrap}
.mi:hover,.mi:focus-visible{background:#181818;outline:none}
.mi .mark{width:1.05rem;height:1.05rem;color:var(--soft)}
.mi:hover .mark{color:var(--ink)}
.mi u{margin-left:auto;color:var(--faint);text-decoration:none;font-size:.68rem;
letter-spacing:.1em;text-transform:uppercase}
/* Works-with bar: one scrolling row, name and mark per agent. */
.strip{border-bottom:1px solid var(--line);background:var(--panel)}
.strip .in{max-width:60rem;margin:0 auto;padding:.9rem 1.75rem;display:flex;
align-items:center;gap:1.25rem;font-family:var(--mono);font-size:.72rem;
letter-spacing:.1em;text-transform:uppercase;color:var(--faint)}
.strip b{color:var(--soft);font-weight:400;flex:0 0 auto;
border-right:1px solid var(--line);padding-right:1.25rem;align-self:stretch;
display:flex;align-items:center}
.bar{display:flex;align-items:center;gap:.5rem;flex:1 1 auto;min-width:0;
overflow-x:auto;scrollbar-width:none;scroll-snap-type:x proximity;
-webkit-overflow-scrolling:touch;
-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 3rem),transparent);
mask-image:linear-gradient(90deg,#000 calc(100% - 3rem),transparent)}
.bar::-webkit-scrollbar{display:none}
.agent{display:inline-flex;align-items:center;gap:.45rem;flex:0 0 auto;
padding:.4rem .85rem;border:1px solid var(--line);border-radius:var(--r);
color:var(--soft);white-space:nowrap;scroll-snap-align:start;
text-decoration:none;background:var(--ground)}
.agent:hover{color:var(--ink);border-color:var(--line-hi);text-decoration:none}
.agent .mark{width:.95rem;height:.95rem}
h2{font-family:var(--mono);font-size:1.1rem;letter-spacing:-.01em;margin:2.75rem 0 .75rem;font-weight:500}
h3{font-size:1rem;margin:2rem 0 .5rem;font-weight:600}
h4,h5,h6{font-size:.94rem;margin:1.5rem 0 .5rem;font-weight:600}
p{margin:0 0 1rem;max-width:70ch}
ul,ol{margin:0 0 1rem;padding-left:1.35rem;max-width:70ch}
li{margin:.22rem 0}
a{color:var(--ink);text-decoration:underline;text-underline-offset:3px;
text-decoration-color:var(--line-hi)}
a:hover{text-decoration-color:var(--ink)}
a:focus-visible{outline:1px solid var(--ink);outline-offset:3px}
code{font-family:var(--mono);font-size:.85em;background:var(--panel);
border:1px solid var(--line);border-radius:5px;padding:.1em .36em}
pre{background:var(--panel);border:1px solid var(--line);padding:1rem 1.1rem;
border-radius:var(--r-soft);overflow-x:auto;margin:0 0 1.25rem}
pre code{background:none;border:0;padding:0;font-size:.82rem;line-height:1.7}
blockquote{margin:0 0 1rem;padding-left:1rem;border-left:1px solid var(--line-hi);color:var(--soft)}
hr{border:0;border-top:1px solid var(--line);margin:2.5rem 0}
table{border-collapse:collapse;width:100%;margin:0 0 1.25rem;font-size:.92rem;
display:block;overflow-x:auto}
th,td{border:1px solid var(--line);padding:.5rem .7rem;text-align:left}
.curl{display:block;background:var(--panel);border:1px solid var(--line);
border-radius:var(--r-soft);padding:.95rem 1.1rem;font-family:var(--mono);
font-size:.8rem;color:var(--soft);overflow-x:auto;margin:0 0 2.5rem;
white-space:pre;line-height:1.9}
.curl b{color:var(--ink);font-weight:400}
.curl i{font-style:normal;color:var(--faint)}
/* index */
#q{width:100%;padding:.85rem 1.2rem;font-family:var(--mono);font-size:.85rem;color:var(--ink);
background:var(--panel);border:1px solid var(--line);border-radius:var(--r);margin:0 0 .6rem}
#q::placeholder{color:var(--faint);text-transform:uppercase;letter-spacing:.1em;font-size:.72rem}
#q:focus{outline:none;border-color:var(--soft)}
#count{color:var(--faint);font-family:var(--mono);font-size:.72rem;letter-spacing:.1em;
text-transform:uppercase;margin:0 0 2rem}
.cat{margin:2.5rem 0 .5rem;font-family:var(--mono);font-size:.7rem;letter-spacing:.16em;
text-transform:uppercase;color:var(--faint);border-bottom:1px solid var(--line);
padding-bottom:.45rem}
.row{display:block;padding:.6rem .9rem;margin:0 -.9rem;border-bottom:1px solid var(--line);
border-radius:var(--r-soft);text-decoration:none}
.row:hover{background:#0a0a0a}
.nm{font-family:var(--mono);font-size:.84rem;color:var(--ink);display:block}
.ds{color:var(--soft);font-size:.9rem;display:block;margin-top:.12rem}
footer{margin-top:4rem;padding:2rem 0 4rem;border-top:1px solid var(--line);
color:var(--faint);font-size:.85rem}
footer a{color:var(--soft)}
.fmap{display:grid;gap:1.75rem;grid-template-columns:repeat(auto-fit,minmax(11rem,1fr));
margin:0 0 2rem;font-size:.85rem}
.fmap b{display:block;font-family:var(--mono);font-size:.68rem;letter-spacing:.16em;
text-transform:uppercase;color:var(--faint);font-weight:400;margin:0 0 .6rem;
border-bottom:1px solid var(--line);padding-bottom:.4rem}
.fmap a{display:inline-block;color:var(--ink);text-decoration:none;margin:.3rem .35rem 0 0}
.fmap a:hover{text-decoration:underline}
.fmap div{color:var(--faint);line-height:1.5}
.fend{border-top:1px solid var(--line);padding-top:1.25rem;font-size:.82rem}
@media (max-width:640px){
.hero .wrap{padding-top:3.25rem;padding-bottom:2.75rem}
.btns{gap:.5rem}
.btn{padding:.75rem 1.15rem;font-size:.68rem}
.copy,.copy .btn{width:100%;justify-content:center}
.menu{left:0;right:0;min-width:0}
.strip .in{flex-direction:column;align-items:flex-start;gap:.6rem;padding:.9rem 1.75rem}
.strip b{border-right:0;padding-right:0}
.bar{width:100%}
}
</style>
<link rel="alternate" type="text/markdown" href="/security-vulnerability-assessment.md">
<link rel="icon" href="/favicon.svg">
<link rel="canonical" href="https://hanzoskills.com/security-vulnerability-assessment">
</head>
<!-- Reading this with a machine? Every page here is also plain markdown.
This one: https://hanzoskills.com/security-vulnerability-assessment.md
Index: https://hanzoskills.com/llms.txt
Corpus: https://hanzoskills.com/all.md
Append .md to any path for the markdown twin. -->
<body>
<nav><div class="in">
<a class="brand" href="/"><svg class="mark" viewBox="0 0 67 67" fill="currentColor" aria-hidden="true"><path d="M22.21 67V44.6369H0V67H22.21Z"/><path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z"/><path d="M22.21 0H0V22.3184H22.21V0Z"/><path d="M66.7198 0H44.5098V22.3184H66.7198V0Z"/><path d="M66.7198 67V44.6369H44.5098V67H66.7198Z"/></svg> HANZO<i>SKILLS</i></a>
<a class="up" href="/">All skills</a>
</div></nav>
<div class="wrap">
<h1>security-vulnerability-assessment</h1><p class="lede">Security testing methodologies, OWASP Top 10, vulnerability scanning tools, and penetration testing practices</p><h1>Security: Vulnerability Assessment</h1>
<p><strong>Scope</strong>: Security testing, OWASP Top 10, scanning tools, pentesting, security audits <strong>Lines</strong>: ~390 <strong>Last Updated</strong>: 2025-10-27</p>
<h2>When to Use This Skill</h2>
<p>Activate this skill when:</p>
<ul><li>Performing security audits of applications</li><li>Testing for OWASP Top 10 vulnerabilities</li><li>Setting up automated security scanning</li><li>Conducting penetration testing</li><li>Reviewing code for security issues</li><li>Preparing for security certifications</li><li>Implementing DevSecOps practices</li></ul>
<h2>OWASP Top 10 (2021)</h2>
<h3>A01: Broken Access Control</h3>
<p><strong>Description</strong>: Unauthorized access to resources or actions</p>
<p><strong>Testing</strong>:</p>
<pre><code class="lang-python">import requests
def test_broken_access_control():
&quot;&quot;&quot;Test for access control vulnerabilities&quot;&quot;&quot;
# Test 1: IDOR (Insecure Direct Object Reference)
# Try accessing another user&#x27;s resource
user1_token = login(&quot;[email protected]&quot;, &quot;password&quot;)
user2_id = 42
response = requests.get(
f&quot;https://api.example.com/users/{user2_id}/profile&quot;,
headers={&quot;Authorization&quot;: f&quot;Bearer {user1_token}&quot;}
)
# Should return 403 Forbidden
assert response.status_code == 403, &quot;IDOR vulnerability detected&quot;
# Test 2: Path traversal
response = requests.get(
&quot;https://api.example.com/files/../../etc/passwd&quot;
)
assert response.status_code in [400, 403, 404], &quot;Path traversal possible&quot;
# Test 3: Privilege escalation
# Try to access admin endpoint with regular user
response = requests.get(
&quot;https://api.example.com/admin/users&quot;,
headers={&quot;Authorization&quot;: f&quot;Bearer {user1_token}&quot;}
)
assert response.status_code == 403, &quot;Privilege escalation possible&quot;
# Test 4: Missing authorization check
# Try to access protected resource without authentication
response = requests.get(&quot;https://api.example.com/admin/dashboard&quot;)
assert response.status_code == 401, &quot;Missing authentication check&quot;</code></pre>
<h3>A02: Cryptographic Failures</h3>
<p><strong>Description</strong>: Weak or missing encryption, exposed sensitive data</p>
<p><strong>Testing</strong>:</p>
<pre><code class="lang-python">def test_cryptographic_failures():
&quot;&quot;&quot;Test for weak cryptography&quot;&quot;&quot;
# Test 1: Check HTTPS enforcement
response = requests.get(&quot;http://example.com&quot;, allow_redirects=False)
assert response.status_code == 301, &quot;HTTP not redirected to HTTPS&quot;
assert response.headers[&#x27;Location&#x27;].startswith(&#x27;https://&#x27;), &quot;No HTTPS redirect&quot;
# Test 2: Check TLS version
import ssl
import socket
context = ssl.create_default_context()
context.minimum_version = ssl.TLSVersion.TLSv1_2
with socket.create_connection((&quot;example.com&quot;, 443)) as sock:
with context.wrap_socket(sock, server_hostname=&quot;example.com&quot;) as ssock:
version = ssock.version()
assert version in [&quot;TLSv1.2&quot;, &quot;TLSv1.3&quot;], f&quot;Weak TLS: {version}&quot;
# Test 3: Check for sensitive data in response
response = requests.get(&quot;https://api.example.com/users/me&quot;)
data = response.json()
# Password should never be in response
assert &#x27;password&#x27; not in data, &quot;Password exposed in response&quot;
assert &#x27;password_hash&#x27; not in data, &quot;Password hash exposed&quot;
# Test 4: Check cookie security
response = requests.get(&quot;https://example.com&quot;)
cookies = response.cookies
for cookie in cookies:
assert cookie.secure, f&quot;Cookie {cookie.name} not secure&quot;
assert cookie.has_nonstandard_attr(&#x27;HttpOnly&#x27;), f&quot;Cookie {cookie.name} not HttpOnly&quot;</code></pre>
<h3>A03: Injection</h3>
<p><strong>Description</strong>: SQL injection, command injection, XSS</p>
<p><strong>Testing</strong>:</p>
<pre><code class="lang-python">def test_sql_injection():
&quot;&quot;&quot;Test for SQL injection vulnerabilities&quot;&quot;&quot;
# Test payloads
# Example SQL injection attack payloads - for security testing only
payloads = [
&quot;&#x27; OR &#x27;1&#x27;=&#x27;1&quot;,
&quot;&#x27; OR &#x27;1&#x27;=&#x27;1&#x27; --&quot;,
&quot;&#x27;; DROP TABLE users; --&quot;, # Example of destructive injection payload
&quot;&#x27; UNION SELECT NULL, NULL, NULL --&quot;,
&quot;admin&#x27;--&quot;,
]
for payload in payloads:
response = requests.post(
&quot;https://api.example.com/login&quot;,
json={&quot;username&quot;: payload, &quot;password&quot;: &quot;test&quot;}
)
# Should return error, not success
assert response.status_code in [400, 401], f&quot;SQL injection with: {payload}&quot;
# Check error message doesn&#x27;t leak SQL details
assert &#x27;SQL&#x27; not in response.text.upper(), &quot;SQL error leaked&quot;
assert &#x27;syntax&#x27; not in response.text.lower(), &quot;SQL syntax error leaked&quot;
def test_command_injection():
&quot;&quot;&quot;Test for command injection&quot;&quot;&quot;
payloads = [
&quot;google.com; ls -la&quot;,
&quot;google.com &amp;&amp; cat /etc/passwd&quot;,
&quot;google.com | whoami&quot;,
&quot;$(cat /etc/passwd)&quot;,
&quot;`cat /etc/passwd`&quot;,
]
for payload in payloads:
response = requests.get(
f&quot;https://api.example.com/ping?host={payload}&quot;
)
# Should not execute commands
assert &#x27;root:&#x27; not in response.text, f&quot;Command injection: {payload}&quot;
assert &#x27;bin/bash&#x27; not in response.text, f&quot;Command injection: {payload}&quot;
def test_xss():
&quot;&quot;&quot;Test for XSS vulnerabilities&quot;&quot;&quot;
payloads = [
&quot;&lt;script&gt;alert(&#x27;XSS&#x27;)&lt;/script&gt;&quot;,
&quot;&lt;img src=x onerror=alert(&#x27;XSS&#x27;)&gt;&quot;,
&quot;javascript:alert(&#x27;XSS&#x27;)&quot;,
&quot;&lt;svg onload=alert(&#x27;XSS&#x27;)&gt;&quot;,
]
for payload in payloads:
response = requests.post(
&quot;https://example.com/comments&quot;,
json={&quot;content&quot;: payload}
)
# Fetch the comment
comment_id = response.json()[&#x27;id&#x27;]
response = requests.get(f&quot;https://example.com/comments/{comment_id}&quot;)
# Script tags should be escaped
assert &#x27;&lt;script&gt;&#x27; not in response.text, f&quot;XSS vulnerability: {payload}&quot;
assert &#x27;onerror=&#x27; not in response.text, f&quot;XSS vulnerability: {payload}&quot;</code></pre>
<h3>A04: Insecure Design</h3>
<p><strong>Description</strong>: Missing or ineffective control design</p>
<p><strong>Testing</strong>:</p>
<pre><code class="lang-python">def test_insecure_design():
&quot;&quot;&quot;Test for design flaws&quot;&quot;&quot;
# Test 1: Rate limiting
for i in range(20):
response = requests.post(
&quot;https://api.example.com/login&quot;,
json={&quot;email&quot;: &quot;[email protected]&quot;, &quot;password&quot;: &quot;wrong&quot;}
)
# Should be rate limited after multiple attempts
assert response.status_code == 429, &quot;No rate limiting on auth endpoint&quot;
# Test 2: Account enumeration
response1 = requests.post(
&quot;https://api.example.com/login&quot;,
json={&quot;email&quot;: &quot;[email protected]&quot;, &quot;password&quot;: &quot;wrong&quot;}
)
response2 = requests.post(
&quot;https://api.example.com/login&quot;,
json={&quot;email&quot;: &quot;[email protected]&quot;, &quot;password&quot;: &quot;wrong&quot;}
)
# Error messages should be identical
assert response1.json()[&#x27;error&#x27;] == response2.json()[&#x27;error&#x27;], \
&quot;Account enumeration possible via error messages&quot;
# Test 3: Password reset flow
# Should require email verification
response = requests.post(
&quot;https://api.example.com/password-reset&quot;,
json={&quot;email&quot;: &quot;[email protected]&quot;}
)
# Should not reveal if email exists
assert &quot;email sent&quot; in response.json()[&#x27;message&#x27;].lower(), \
&quot;Password reset reveals account existence&quot;</code></pre>
<h3>A05: Security Misconfiguration</h3>
<p><strong>Description</strong>: Insecure default configs, unnecessary features enabled</p>
<p><strong>Testing</strong>:</p>
<pre><code class="lang-python">def test_security_misconfiguration():
&quot;&quot;&quot;Test for misconfigurations&quot;&quot;&quot;
# Test 1: Security headers
response = requests.get(&quot;https://example.com&quot;)
required_headers = [
&#x27;Strict-Transport-Security&#x27;,
&#x27;X-Frame-Options&#x27;,
&#x27;X-Content-Type-Options&#x27;,
&#x27;Content-Security-Policy&#x27;
]
for header in required_headers:
assert header in response.headers, f&quot;Missing security header: {header}&quot;
# Test 2: Exposed debug information
assert &#x27;X-Powered-By&#x27; not in response.headers, &quot;Server info exposed&quot;
assert &#x27;Server&#x27; not in response.headers or \
&#x27;nginx&#x27; not in response.headers.get(&#x27;Server&#x27;, &#x27;&#x27;).lower(), \
&quot;Detailed server version exposed&quot;
# Test 3: Directory listing
response = requests.get(&quot;https://example.com/static/&quot;)
assert &#x27;Index of&#x27; not in response.text, &quot;Directory listing enabled&quot;
# Test 4: Default credentials
default_creds = [
(&quot;admin&quot;, &quot;admin&quot;),
(&quot;admin&quot;, &quot;password&quot;),
(&quot;root&quot;, &quot;root&quot;),
]
for username, password in default_creds:
response = requests.post(
&quot;https://api.example.com/login&quot;,
json={&quot;username&quot;: username, &quot;password&quot;: password}
)
assert response.status_code == 401, f&quot;Default credentials work: {username}&quot;</code></pre>
<h3>A06: Vulnerable and Outdated Components</h3>
<p><strong>Description</strong>: Using components with known vulnerabilities</p>
<p><strong>Testing</strong>:</p>
<pre><code class="lang-bash"># Python dependencies
pip install safety
safety check
pip install pip-audit
pip-audit
# Node.js dependencies
npm audit
npm audit fix
# Check Docker base images
docker scan myimage:latest
# Use Snyk
snyk test
snyk monitor
# Use Trivy
trivy image myimage:latest</code></pre>
<pre><code class="lang-python"># Automated dependency checking
import requests
import json
def check_dependencies_for_vulnerabilities(requirements_file):
&quot;&quot;&quot;Check Python dependencies against OSV database&quot;&quot;&quot;
with open(requirements_file) as f:
packages = [line.strip() for line in f if line.strip()]
vulnerabilities = []
for package in packages:
name, version = package.split(&#x27;==&#x27;)
response = requests.post(
&#x27;https://api.osv.dev/v1/query&#x27;,
json={&#x27;package&#x27;: {&#x27;name&#x27;: name, &#x27;ecosystem&#x27;: &#x27;PyPI&#x27;},
&#x27;version&#x27;: version}
)
if response.status_code == 200:
data = response.json()
if &#x27;vulns&#x27; in data and data[&#x27;vulns&#x27;]:
vulnerabilities.append({
&#x27;package&#x27;: name,
&#x27;version&#x27;: version,
&#x27;vulnerabilities&#x27;: data[&#x27;vulns&#x27;]
})
return vulnerabilities</code></pre>
<h3>A07: Identification and Authentication Failures</h3>
<p><strong>Description</strong>: Weak authentication, session management issues</p>
<p><strong>Testing</strong>:</p>
<pre><code class="lang-python">def test_authentication_failures():
&quot;&quot;&quot;Test authentication mechanisms&quot;&quot;&quot;
# Test 1: Weak passwords accepted
weak_passwords = [&quot;password&quot;, &quot;12345678&quot;, &quot;qwerty&quot;, &quot;admin&quot;]
for pwd in weak_passwords:
response = requests.post(
&quot;https://api.example.com/register&quot;,
json={&quot;email&quot;: &quot;[email protected]&quot;, &quot;password&quot;: pwd}
)
assert response.status_code == 400, f&quot;Weak password accepted: {pwd}&quot;
# Test 2: Session fixation
# Get session ID before login
session = requests.Session()
response1 = session.get(&quot;https://example.com&quot;)
session_id_before = session.cookies.get(&#x27;session_id&#x27;)
# Login
session.post(&quot;https://example.com/login&quot;,
json={&quot;email&quot;: &quot;[email protected]&quot;, &quot;password&quot;: &quot;password&quot;})
# Session ID should change after login
session_id_after = session.cookies.get(&#x27;session_id&#x27;)
assert session_id_before != session_id_after, &quot;Session fixation vulnerability&quot;
# Test 3: Brute force protection
for i in range(10):
response = requests.post(
&quot;https://api.example.com/login&quot;,
json={&quot;email&quot;: &quot;[email protected]&quot;, &quot;password&quot;: &quot;wrong&quot;}
)
# Should be locked or rate limited
assert response.status_code in [429, 403], &quot;No brute force protection&quot;
# Test 4: JWT validation
# Try using expired token
expired_token = &quot;eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...&quot; # Test token for security validation only
response = requests.get(
&quot;https://api.example.com/protected&quot;,
headers={&quot;Authorization&quot;: f&quot;Bearer {expired_token}&quot;}
)
assert response.status_code == 401, &quot;Expired JWT accepted&quot;</code></pre>
<h3>A08-A10: Other OWASP Vulnerabilities</h3>
<pre><code class="lang-python">def test_software_data_integrity_failures():
&quot;&quot;&quot;A08: Software and Data Integrity Failures&quot;&quot;&quot;
# Test unsigned packages, missing integrity checks
response = requests.get(&quot;https://example.com&quot;)
html = response.text
# Check for Subresource Integrity (SRI)
if &#x27;&lt;script src=&quot;https://cdn&#x27; in html:
assert &#x27;integrity=&quot;sha&#x27; in html, &quot;Missing SRI for external scripts&quot;
def test_logging_monitoring_failures():
&quot;&quot;&quot;A09: Security Logging and Monitoring Failures&quot;&quot;&quot;
# Attempt suspicious activity
requests.post(
&quot;https://api.example.com/login&quot;,
json={&quot;email&quot;: &quot;&#x27; OR &#x27;1&#x27;=&#x27;1&quot;, &quot;password&quot;: &quot;test&quot;}
)
# Check if activity is logged (requires access to logs)
# In practice, verify logging configuration
def test_ssrf():
&quot;&quot;&quot;A10: Server-Side Request Forgery&quot;&quot;&quot;
# Try to access internal services
payloads = [
&quot;http://localhost:8080&quot;,
&quot;http://127.0.0.1&quot;,
&quot;http://169.254.169.254/latest/meta-data/&quot;, # AWS metadata
&quot;file:///etc/passwd&quot;,
]
for payload in payloads:
response = requests.post(
&quot;https://api.example.com/fetch-url&quot;,
json={&quot;url&quot;: payload}
)
assert response.status_code in [400, 403], f&quot;SSRF possible: {payload}&quot;</code></pre>
<h2>Automated Security Scanning Tools</h2>
<h3>Static Analysis (SAST)</h3>
<pre><code class="lang-bash"># Python: Bandit
pip install bandit
bandit -r . -f json -o bandit-report.json
# Python: Semgrep
pip install semgrep
semgrep --config=auto --json --output=semgrep-report.json
# Python: Pylint security plugin
pip install pylint-security
pylint --load-plugins=pylint_security myapp/
# Node.js: ESLint with security plugins
npm install --save-dev eslint-plugin-security
eslint . --ext .js,.ts
# Go: Gosec
go install github.com/securego/gosec/v2/cmd/gosec@latest
gosec ./...</code></pre>
<h3>Dynamic Analysis (DAST)</h3>
<pre><code class="lang-bash"># OWASP ZAP (Zed Attack Proxy)
docker run -t owasp/zap2docker-stable zap-baseline.py \
-t https://example.com \
-r zap-report.html
# Burp Suite (commercial)
# Use for manual penetration testing
# Nikto (web server scanner)
nikto -h https://example.com -o nikto-report.txt
# SQLMap (SQL injection)
sqlmap -u &quot;https://example.com/page?id=1&quot; --batch
# Nuclei (vulnerability scanner)
nuclei -u https://example.com -t cves/</code></pre>
<h3>Dependency Scanning (SCA)</h3>
<pre><code class="lang-bash"># Python: Safety
safety check --json --output safety-report.json
# Python: pip-audit
pip-audit --format json --output pip-audit-report.json
# Node.js: npm audit
npm audit --json &gt; npm-audit-report.json
# Node.js: Snyk
snyk test --json &gt; snyk-report.json
# Docker: Trivy
trivy image myimage:latest --format json --output trivy-report.json
# Docker: Grype
grype myimage:latest -o json &gt; grype-report.json</code></pre>
<h3>Container Security</h3>
<pre><code class="lang-bash"># Scan container image
docker scan myimage:latest
# Trivy comprehensive scan
trivy image --severity HIGH,CRITICAL myimage:latest
# Clair (open source)
docker run -d --name clair arminc/clair-local-scan:latest
clair-scanner myimage:latest
# Anchore Engine
anchore-cli image add myimage:latest
anchore-cli image vuln myimage:latest all</code></pre>
<h2>Penetration Testing Methodology</h2>
<h3>Reconnaissance</h3>
<pre><code class="lang-python">import nmap
import requests
from bs4 import BeautifulSoup
def passive_reconnaissance(domain):
&quot;&quot;&quot;Gather information without touching target&quot;&quot;&quot;
# DNS lookup
import dns.resolver
resolver = dns.resolver.Resolver()
records = {
&#x27;A&#x27;: resolver.resolve(domain, &#x27;A&#x27;),
&#x27;MX&#x27;: resolver.resolve(domain, &#x27;MX&#x27;),
&#x27;TXT&#x27;: resolver.resolve(domain, &#x27;TXT&#x27;),
}
# WHOIS lookup
import whois
domain_info = whois.whois(domain)
# Subdomain enumeration (passive)
# Use crt.sh (certificate transparency logs)
response = requests.get(f&quot;https://crt.sh/?q=%.{domain}&amp;output=json&quot;)
subdomains = set()
if response.status_code == 200:
for cert in response.json():
subdomains.add(cert[&#x27;name_value&#x27;])
return {
&#x27;dns_records&#x27;: records,
&#x27;whois&#x27;: domain_info,
&#x27;subdomains&#x27;: list(subdomains)
}
def active_reconnaissance(target):
&quot;&quot;&quot;Active scanning (requires permission)&quot;&quot;&quot;
# Port scanning
nm = nmap.PortScanner()
nm.scan(target, &#x27;1-1000&#x27;)
open_ports = []
for host in nm.all_hosts():
for proto in nm[host].all_protocols():
ports = nm[host][proto].keys()
for port in ports:
if nm[host][proto][port][&#x27;state&#x27;] == &#x27;open&#x27;:
open_ports.append({
&#x27;port&#x27;: port,
&#x27;service&#x27;: nm[host][proto][port][&#x27;name&#x27;]
})
return open_ports</code></pre>
<h3>Security Testing Checklist</h3>
<p><strong>Before Testing</strong>:</p>
<ul><li>[ ] Get written authorization</li><li>[ ] Define scope clearly</li><li>[ ] Set up isolated test environment</li><li>[ ] Backup production data</li><li>[ ] Schedule testing window</li></ul>
<p><strong>Authentication</strong>:</p>
<ul><li>[ ] Test weak passwords</li><li>[ ] Test account lockout</li><li>[ ] Test session management</li><li>[ ] Test JWT validation</li><li>[ ] Test MFA bypass</li></ul>
<p><strong>Authorization</strong>:</p>
<ul><li>[ ] Test IDOR vulnerabilities</li><li>[ ] Test privilege escalation</li><li>[ ] Test missing auth checks</li><li>[ ] Test cross-tenant access</li></ul>
<p><strong>Input Validation</strong>:</p>
<ul><li>[ ] Test SQL injection</li><li>[ ] Test XSS (reflected, stored, DOM)</li><li>[ ] Test command injection</li><li>[ ] Test path traversal</li><li>[ ] Test file upload vulnerabilities</li></ul>
<p><strong>Configuration</strong>:</p>
<ul><li>[ ] Test security headers</li><li>[ ] Test HTTPS enforcement</li><li>[ ] Test exposed debug info</li><li>[ ] Test default credentials</li><li>[ ] Test directory listing</li></ul>
<p><strong>Business Logic</strong>:</p>
<ul><li>[ ] Test rate limiting</li><li>[ ] Test race conditions</li><li>[ ] Test workflow bypass</li><li>[ ] Test payment manipulation</li></ul>
<h2>CI/CD Security Integration</h2>
<h3>GitHub Actions Security Scanning</h3>
<pre><code class="lang-yaml">name: Security Scan
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Bandit (Python SAST)
run: |
pip install bandit
bandit -r . -f json -o bandit-report.json
continue-on-error: true
- name: Run Safety (Dependency Check)
run: |
pip install safety
safety check --json --output safety-report.json
continue-on-error: true
- name: Run Semgrep
uses: returntocorp/semgrep-action@v1
- name: Run Trivy (Container Scan)
uses: aquasecurity/trivy-action@master
with:
image-ref: &#x27;myapp:${{ github.sha }}&#x27;
format: &#x27;sarif&#x27;
output: &#x27;trivy-results.sarif&#x27;
- name: Upload results to GitHub Security
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: &#x27;trivy-results.sarif&#x27;</code></pre>
<h2>Security Best Practices</h2>
<h3>Security Testing Checklist</h3>
<p><strong>Automated Testing</strong>:</p>
<ul><li>[ ] SAST in CI/CD pipeline</li><li>[ ] Dependency scanning daily</li><li>[ ] Container scanning before deployment</li><li>[ ] DAST on staging environment</li><li>[ ] Security regression tests</li></ul>
<p><strong>Manual Testing</strong>:</p>
<ul><li>[ ] Quarterly penetration tests</li><li>[ ] Annual security audits</li><li>[ ] Code reviews for security</li><li>[ ] Architecture reviews</li><li>[ ] Threat modeling sessions</li></ul>
<p><strong>Monitoring</strong>:</p>
<ul><li>[ ] Security logging enabled</li><li>[ ] Anomaly detection configured</li><li>[ ] Intrusion detection system (IDS)</li><li>[ ] WAF (Web Application Firewall)</li><li>[ ] Regular log reviews</li></ul>
<h2>Level 3 Resources</h2>
<p>This skill includes <strong>executable scripts, detailed references, and validated examples</strong> in the <code>resources/</code> directory.</p>
<h3>๐Ÿ“ Resources Directory Structure</h3>
<pre><code>skills/security/vulnerability-assessment/resources/
โ”œโ”€โ”€ REFERENCE.md # Detailed OWASP Top 10 reference, CVE patterns, tools
โ”œโ”€โ”€ scripts/
โ”‚ โ”œโ”€โ”€ README.md # Script documentation and usage
โ”‚ โ”œโ”€โ”€ test_owasp_top10.py # Executable OWASP Top 10 test suite
โ”‚ โ””โ”€โ”€ scan_dependencies.sh # Automated dependency vulnerability scanning
โ””โ”€โ”€ examples/
โ”œโ”€โ”€ python/ # Standalone test examples
โ””โ”€โ”€ ci-cd/ # CI/CD integration examples</code></pre>
<h3>๐Ÿš€ Quick Start: Run Security Tests</h3>
<p><strong>Test for OWASP Top 10 vulnerabilities</strong>:</p>
<pre><code class="lang-bash"># Full test suite
python resources/scripts/test_owasp_top10.py \
--target https://staging.example.com \
--report security-report.json \
--verbose
# Specific test
python resources/scripts/test_owasp_top10.py \
--target https://staging.example.com \
--test A01 \
--verbose</code></pre>
<p><strong>Scan dependencies for vulnerabilities</strong>:</p>
<pre><code class="lang-bash"># Scan Python project
./resources/scripts/scan_dependencies.sh \
--project-dir /path/to/project \
--output scan-results.json
# Scan Docker image
./resources/scripts/scan_dependencies.sh \
--docker-image myapp:latest \
--output docker-scan.json</code></pre>
<h3>๐Ÿ“š Reference Material</h3>
<p><strong>Load detailed reference</strong>:</p>
<pre><code class="lang-bash">cat resources/REFERENCE.md</code></pre>
<p>Contains:</p>
<ul><li>OWASP Top 10 (2021) detailed breakdown with CWE mappings</li><li>Real-world CVE examples (Log4Shell, Heartbleed, GitLab bypass)</li><li>Security testing tools comparison (SAST, DAST, SCA)</li><li>Common vulnerability patterns and exploitation techniques</li><li>Compliance frameworks (OWASP ASVS, PCI DSS, CWE Top 25)</li><li>Vulnerability databases and resources</li></ul>
<h3>โš™๏ธ Scripts Overview</h3>
<p>| Script | Purpose | On-Demand Context Loading | |--------|---------|--------------------------| | <code>test_owasp_top10.py</code> | Automated OWASP Top 10 testing suite | Run via bash - code never loaded into context | | <code>scan_dependencies.sh</code> | Multi-tool dependency scanner (Safety, pip-audit, npm, Trivy) | Executable script, minimal context | | <code>REFERENCE.md</code> | Detailed specs, CVE examples, tool comparisons | Load only when needed for deep reference |</p>
<p><strong>Benefits of Level 3 Resources</strong>:</p>
<ul><li>โœ… <strong>Context-efficient</strong>: Scripts executed via bash without loading code into context</li><li>โœ… <strong>Production-ready</strong>: Validated, executable tools ready for immediate use</li><li>โœ… <strong>Comprehensive</strong>: Detailed reference material available on-demand</li><li>โœ… <strong>CI/CD-ready</strong>: JSON output for easy integration with pipelines</li></ul>
<hr>
<h2>Related Skills</h2>
<ul><li><code>security-authentication.md</code> - Testing auth mechanisms</li><li><code>security-authorization.md</code> - Testing access control</li><li><code>security-input-validation.md</code> - Testing input validation</li><li><code>security-headers.md</code> - Testing security headers</li><li><code>testing-integration.md</code> - Security integration tests</li></ul>
<hr>
<p><strong>Last Updated</strong>: 2025-10-27 <strong>Format Version</strong>: 1.0 (Atomic) + Level 3 Resources</p>
<footer>
<div class="fmap">
<div><b>Build</b>
<a href="https://hanzo.app">hanzo.app</a> app builder
<a href="https://hanzo.codes">hanzo.codes</a> code with an agent
<a href="https://hanzoskills.com">hanzoskills.com</a> what an agent reads</div>
<div><b>Run</b>
<a href="https://console.hanzo.ai">console.hanzo.ai</a> cloud console
<a href="https://api.hanzo.ai">api.hanzo.ai</a> the API</div>
<div><b>Account</b>
<a href="https://hanzo.id">hanzo.id</a> sign in
<a href="https://pay.hanzo.ai">pay.hanzo.ai</a> top up
<a href="https://billing.hanzo.ai">billing.hanzo.ai</a> invoices and usage</div>
<div><b>Company</b>
<a href="https://hanzo.ai">hanzo.ai</a> canonical
<a href="https://hanzo.ventures">hanzo.ventures</a> ventures</div>
</div>
<div class="fend"><a href="/security-vulnerability-assessment.md">This page as plain text</a> ยท <a href="/llms.txt">Index for agents</a></div>
</footer>
</div></body></html>