You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by as...@apache.org on 2026/05/05 12:15:47 UTC
(tooling-agents) branch main updated: ASVS audit: 4.2.4.md (redacted)
This is an automated email from the ASF dual-hosted git repository.
asf-tooling pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-agents.git
The following commit(s) were added to refs/heads/main by this push:
new 6d84ad3 ASVS audit: 4.2.4.md (redacted)
6d84ad3 is described below
commit 6d84ad35170368cfa2cf31dbcc13b638e7a12d6c
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Tue May 5 14:07:34 2026 +0200
ASVS audit: 4.2.4.md (redacted)
---
ASVS/reports/steve/v3/d0aa7e9/all/4.2.4.md | 133 +++++++++++++++++++++++++++++
1 file changed, 133 insertions(+)
diff --git a/ASVS/reports/steve/v3/d0aa7e9/all/4.2.4.md b/ASVS/reports/steve/v3/d0aa7e9/all/4.2.4.md
new file mode 100644
index 0000000..2e8188d
--- /dev/null
+++ b/ASVS/reports/steve/v3/d0aa7e9/all/4.2.4.md
@@ -0,0 +1,133 @@
+# Security Audit Report: ASVS 4.2.4
+
+## Executive Summary
+
+| Field | Value |
+|-------|-------|
+| **Repository** | apache/steve/v3 |
+| **Audit Date** | May 05, 2026 |
+| **Auditor** | Tooling Agents (bundled-pass mode) |
+| **ASVS Requirement** | ASVS 4.2.4 |
+| **Files Analyzed** | 4 relevant / 49 total |
+| **Files Skipped** | 12 |
+
+**Requirement description:** Verify that the application only accepts HTTP/2 and HTTP/3 requests where the header fields and values do not contain any CR (\r), LF (\n), or CRLF (\r\n) sequences, to prevent header injection attacks.
+
+### Findings Overview
+
+| Severity | Count |
+|----------|-------|
+| 🔴 Critical | 0 |
+| 🟠High | 0 |
+| 🟡 Medium | 0 |
+| 🟢 Low | 1 |
+
+---
+
+## ASVS-4.2.4: CRLF Injection Prevention in HTTP/2 and HTTP/3
+
+### Findings for 4.2.4
+
+### [LOW]
+
+**Finding ID:** ASVS-424-LOW-001
+
+**Title:** No explicit CRLF validation on HTTP/2 or HTTP/3 request header fields
+
+**File:** `v3/server/pages.py` (application-wide)
+
+**Description:** The application does not validate that incoming HTTP/2 or HTTP/3 header field names and values are free of CR (`\r`), LF (`\n`), or CRLF (`\r\n`) sequences. While HTTP/2 and HTTP/3 specifications prohibit these characters and compliant ASGI servers should reject them, there is no application-level defense-in-depth validation.
+
+**Vulnerable Code:**
+
+```python
+# Headers read without CRLF validation
+async def _set_election_date(election, field):
+ result = await basic_info()
+ data = await quart.request.get_json()
+ date_str = data.get('date') # No CRLF check on parsed values
+ # ...
+
+# Session data read without header-level CRLF checks
+async def basic_info():
+ s = await asfquart.session.read()
+ if s:
+ basic.update(
+ uid=s['uid'], # Could originate from headers
+ name=s['fullname'], # Could originate from headers
+ email=s['email'], # Could originate from headers
+ )
+```
+
+**Impact:** If the ASGI server fails to properly reject CRLF-containing headers in HTTP/2 or HTTP/3 (due to a bug or misconfiguration), header injection attacks could occur. However, in practice, this requires a defect in the HTTP/2 protocol implementation.
+
+**Remediation:**
+
+```python
+@APP.before_request
+async def validate_no_crlf_in_headers():
+ """Reject HTTP/2+ requests with CRLF in header fields."""
+ if quart.request.http_version in ('2', '2.0', '3'):
+ for name, value in quart.request.headers:
+ if '\r' in name or '\n' in name or '\r' in value or '\n' in value:
+ quart.abort(400, 'Invalid characters in header fields')
+```
+
+### Security Controls Inventory for 4.2.4
+
+| Control | Location | Coverage Status |
+|---------|----------|-----------------|
+| CRLF validation on headers | Not present | **NOT IMPLEMENTED** |
+| HTTP/2 header validation | ASGI server (assumed) | Delegated, not verified |
+| Input sanitization on header-derived values | Not present | **NOT IMPLEMENTED** |
+
+### Positive Patterns for 4.2.4
+
+1. **No manual header construction from user input**: The application does not construct response headers by concatenating user-supplied values, reducing header injection risk on the response side.
+2. **Framework response generation**: All response headers are set through Quart's API, which handles encoding safely.
+
+---
+
+
+
+## Cross-cutting Architecture Observations
+
+1. **Framework Delegation for HTTP-level Security**: The application relies entirely on Quart/Hypercorn for HTTP protocol handling (message framing, header parsing, Content-Length calculation). While this is appropriate for application code, there is no evidence of explicit server configuration enforcing the HTTP-level security requirements (4.2.1-4.2.4). The security posture depends heavily on the deployment architecture (reverse proxy, ASGI server settings) which is not visible in the [...]
+
+2. **State-Changing GET Requests**: The `/do-open/<eid>` and `/do-close/<eid>` endpoints use GET methods for irreversible state changes. This is particularly concerning in combination with the lack of request smuggling protections (4.2.1), as smuggled GET requests require no body parsing and are easier to exploit.
+
+3. **Placeholder Security Controls**: The CSRF token (`basic.csrf_token = 'placeholder'`) and multiple `### check authz` comments indicate that important security controls are planned but not yet implemented. This creates a false sense of security where templates reference tokens that provide no actual protection.
+
+4. **Sensitive Operations Without Defense-in-Depth**: The voting system handles high-integrity operations (irreversible election state changes, anonymous vote collection) but relies on a single layer of protection (TLS + session cookie authentication). There are no per-message signatures (4.1.5), no request integrity verification beyond transport, and limited input validation for the most critical operations.
+
+5. **Client-Server Trust Boundary**: The frontend JavaScript builds and sends requests to the backend, but there is no server-side validation that these requests are well-formed beyond basic format checks. The absence of size limits, combined with session-stored flash messages, creates a DoS vector (4.2.5).
+
+## Cross-cutting Recommendations
+
+### Immediate (Critical/High Priority)
+
+1. **Implement input length validation** on all user-supplied fields (`title`, `description`, `votestring`) before they are stored or included in flash messages. This prevents the cookie overflow DoS (ASVS-425-MED-001).
+
+2. **Change state-changing operations to POST methods** — convert `/do-open/<eid>` and `/do-close/<eid>` from GET to POST to reduce the attack surface for request smuggling and CSRF.
+
+3. **Implement real CSRF protection** — replace the placeholder token with actual token generation and validation, as this is a prerequisite for meaningful request integrity.
+
+### Short-term (Within Next Sprint)
+
+4. **Add request size limits** at the application level via Quart's `MAX_CONTENT_LENGTH` configuration or middleware, setting appropriate bounds for each endpoint.
+
+5. **Configure ASGI server explicitly** — document and configure Hypercorn (or the deployment ASGI server) settings for:
+ - Maximum header size
+ - HTTP/2 settings frame limits
+ - Connection-specific header rejection in HTTP/2
+
+6. **Add before_request middleware** for HTTP protocol validation (TE/CL conflict detection, CRLF rejection, connection-specific header filtering) as defense-in-depth.
+
+### Long-term (Architecture)
+
+7. **Implement per-message signatures** for critical operations (election open/close, vote submission) using a scheme like HTTP Message Signatures (RFC 9421) or application-level HMAC verification, particularly important if the deployment involves load balancers or TLS-terminating proxies.
+
+8. **Implement server-side session storage** (e.g., Redis-backed) rather than cookie-based sessions to eliminate the cookie size DoS vector entirely and reduce the security impact of session data growth.
+
+9. **Add comprehensive authorization checks** to replace all `### check authz` placeholders, ensuring that election ownership is verified before state-changing operations (currently any committer can open/close any election).
+
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org