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/04/22 13:59:07 UTC
(tooling-agents) branch main updated: ASVS L3 audit: 6.4.4 (ch06_general)
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 ff97554 ASVS L3 audit: 6.4.4 (ch06_general)
ff97554 is described below
commit ff97554dee479f8bd79f8cc7fcb253d1a94a90f3
Author: ASF Tooling Team <ro...@apache.org>
AuthorDate: Wed Apr 22 15:59:02 2026 +0200
ASVS L3 audit: 6.4.4 (ch06_general)
---
.../reports/steve/v3/d0aa7e9/ch06_general/6.4.4.md | 272 +++++++++++++++++++++
1 file changed, 272 insertions(+)
diff --git a/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.4.4.md b/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.4.4.md
new file mode 100644
index 0000000..2a9cd62
--- /dev/null
+++ b/repos/apache/ASVS/reports/steve/v3/d0aa7e9/ch06_general/6.4.4.md
@@ -0,0 +1,272 @@
+# ASVS 6.4.4 Security Audit Report
+
+## Executive Summary
+
+- **Repository:** apache/steve
+- **Audit Date:** Apr 22, 2026
+- **Auditor:** Tooling Agents
+- **ASVS Requirement:** 6.4.4 — Verify that if a multi-factor authentication factor is lost, evidence of identity proofing is performed at the same level as during enrollment.
+- **ASVS Level:** 2
+- **Section:** Authentication Factor Lifecycle and Recovery
+- **Files Analyzed:** 8 relevant out of 49 total, 12 skipped
+
+### Finding Counts
+
+| Severity | Count |
+|----------|-------|
+| Critical | 0 |
+| High | 0 |
+| Medium | 1 |
+| Low | 0 |
+| **Total** | **1** |
+
+---
+
+## Security Controls Inventory
+
+| Control Area | Status | Location | Notes |
+|--------------|--------|----------|-------|
+| Authentication | Delegated | `asfquart.auth` decorators in `pages.py` | External ASF OAuth only |
+| MFA Enrollment | **NOT IMPLEMENTED** | N/A | No MFA managed by application |
+| MFA Factor Recovery | **NOT IMPLEMENTED** | N/A | No recovery mechanism exists |
+| Identity Proofing | **NOT IMPLEMENTED** | N/A | No identity verification process |
+| Authentication Strength Verification | **NOT IMPLEMENTED** | `pages.py:basic_info()` | Session read does not check MFA status |
+| Re-authentication for Sensitive Ops | **NOT IMPLEMENTED** | All endpoints | No step-up auth for elections/voting |
+| Session Data | Present | `pages.py:68-78` | Only stores uid, fullname, email — no auth level |
+
+---
+
+## Critical File Review
+
+### `v3/server/pages.py` — Authentication & Session Handling
+
+| Line(s) | Function | Auth Control Applied | MFA/Factor Recovery Control |
+|---------|----------|---------------------|----------------------------|
+| 68-78 | `basic_info()` | Session read (uid/name/email) | **None** — no auth strength check |
+| 133 | `voter_page()` | `{R.committer}` | **None** |
+| 233 | `vote_on_page()` | `{R.committer}` + eligibility check | **None** |
+| 397 | `do_vote_endpoint()` | `{R.committer}` | **None** — no re-auth for voting |
+| 431 | `do_create_endpoint()` | `{R.pmc_member}` | **None** |
+| 449 | `do_open_endpoint()` | `{R.committer}` | **None** — no re-auth for opening |
+| 466 | `do_close_endpoint()` | `{R.committer}` | **None** — no re-auth for closing |
+
+### `v3/steve/persondb.py` — Person Management
+
+| Line(s) | Function | Factor Lifecycle Control |
+|---------|----------|-------------------------|
+| 36-43 | `get_person()` | Returns name/email only — no auth factor data |
+| 46-50 | `add_person()` | Upsert pid/name/email — no factor enrollment |
+| 53-65 | `delete_person()` | Deletes by pid — no factor revocation |
+
+### `v3/schema.sql` — Data Model
+
+| Table | Auth Factor Storage | Recovery Mechanism |
+|-------|-------------------|-------------------|
+| `person` | **None** — only pid, name, email | N/A |
+| `election` | Crypto keys (not auth factors) | N/A |
+| `mayvote` | Crypto salts (not auth factors) | N/A |
+
+---
+
+## Findings
+
+### Medium Severity
+
+#### ASVS-644-MED-001: No Authentication Factor Lifecycle Management for Voting System
+
+**Severity**: MEDIUM
+
+**Location**: Application-wide; primary entry points in `v3/server/pages.py` (all authenticated routes), session handling at lines 64-85
+
+**Related Functions Checked**:
+- `basic_info()` — lines 64-85
+- `voter_page()` — line 133
+- `vote_on_page()` — line 233
+- `do_vote_endpoint()` — line 397
+- `do_create_endpoint()` — line 431
+- `do_open_endpoint()` — line 449
+- `do_close_endpoint()` — line 466
+- `get_person()` — `persondb.py` lines 36-43
+- `add_person()` — `persondb.py` lines 46-50
+
+**Vulnerable Code**:
+```python
+# pages.py lines 64-85
+async def basic_info():
+ """Return base-level EZT template data."""
+ basic = edict()
+ # ...
+ s = await asfquart.session.read()
+ if s:
+ basic.update(
+ uid=s['uid'],
+ name=s['fullname'],
+ email=s['email'],
+ )
+ else:
+ basic.update(uid=None, name=None, email=None)
+
+ ### generate a real token and store in the session
+ basic.csrf_token = 'placeholder'
+ return basic
+```
+
+**Data Flow**:
+- **Source**: External ASF OAuth provider authenticates user
+- **Sink**: Session established with uid/name/email → grants access to all role-permitted operations
+- **Missing Control**: No verification of authentication strength (MFA status), no authentication factor lifecycle management, no identity re-proofing mechanism
+
+**Description**:
+The application delegates all authentication to external ASF OAuth but performs **no verification** of the authentication strength or MFA status of the authenticated session. The session data (`uid`, `fullname`, `email`) contains no information about how the user authenticated or whether MFA was used. Consequently:
+
+1. **No MFA factor recovery process exists**: If a user loses an MFA factor at the ASF OAuth level and regains access through a potentially weakened identity proofing process, the voting application cannot detect or prevent access.
+
+2. **No authentication level tracking**: The session stores no `amr` (authentication methods reference), `acr` (authentication context class), or equivalent field that would indicate whether the user authenticated with MFA.
+
+3. **No re-authentication for sensitive operations**: Critical election operations (voting at `do_vote_endpoint` line 397, opening elections at `do_open_endpoint` line 449, closing elections at `do_close_endpoint` line 466) proceed with only the initial session authentication — no step-up authentication is required.
+
+4. **No compensating controls**: The `person` table schema contains only `pid`, `name`, and `email` — there is no mechanism for local identity proofing, secondary factor enrollment, or factor replacement tracking.
+
+**Proof of Concept**:
+1. A voter enrolls in the ASF ecosystem with MFA enabled
+2. The voter loses their hardware token / TOTP device
+3. The voter recovers their account through ASF's recovery process (which may use lower-assurance identity proofing such as email-only recovery)
+4. The voter authenticates to the voting application — the session is established identically to a full-MFA session
+5. The voting application cannot distinguish between a full-strength MFA session and a recently-recovered session with potentially weakened identity proofing
+6. The voter (or an attacker who compromised the recovery process) can cast votes or manage elections
+
+**Impact**:
+In a voting system where election integrity is paramount, accepting authentication sessions without verifying that MFA factor recovery was accompanied by enrollment-level identity proofing means that:
+- An attacker who social-engineers a factor recovery at the IdP level gains full voting access
+- Elections could be manipulated through compromised accounts that bypassed proper identity re-verification
+- No audit trail exists to distinguish sessions authenticated with full MFA vs. recovered credentials
+
+**Remediation**:
+
+```python
+# Option 1: Verify MFA status from OAuth claims
+async def basic_info():
+ basic = edict()
+ s = await asfquart.session.read()
+ if s:
+ basic.update(
+ uid=s['uid'],
+ name=s['fullname'],
+ email=s['email'],
+ # Check for MFA authentication level from OAuth/OIDC claims
+ mfa_verified=s.get('amr', []),
+ auth_level=s.get('acr', 'unknown'),
+ )
+ else:
+ basic.update(uid=None, name=None, email=None,
+ mfa_verified=[], auth_level=None)
+ return basic
+
+
+# Option 2: Require step-up authentication for sensitive operations
+def require_mfa(func):
+ """Decorator to enforce MFA verification for sensitive operations."""
+ @functools.wraps(func)
+ async def wrapper(*args, **kwargs):
+ s = await asfquart.session.read()
+ if not s:
+ quart.abort(401)
+
+ # Verify MFA was used in current session
+ amr = s.get('amr', [])
+ if 'mfa' not in amr and 'otp' not in amr and 'hwk' not in amr:
+ await flash_danger(
+ 'This operation requires multi-factor authentication. '
+ 'Please re-authenticate with MFA.'
+ )
+ return quart.redirect('/auth/step-up', code=303)
+
+ # Verify session freshness for critical operations
+ auth_time = s.get('auth_time', 0)
+ if time.time() - auth_time > 300: # 5 minute freshness
+ return quart.redirect('/auth/re-authenticate', code=303)
+
+ return await func(*args, **kwargs)
+ return wrapper
+
+
+# Apply to sensitive endpoints
+@APP.post('/do-vote/<eid>')
+@asfquart.auth.require({R.committer})
+@require_mfa # Enforce MFA for voting
+@load_election
+async def do_vote_endpoint(election):
+ ...
+
+@APP.get('/do-open/<eid>')
+@asfquart.auth.require({R.committer})
+@require_mfa # Enforce MFA for opening elections
+@load_election
+async def do_open_endpoint(election):
+ ...
+```
+
+Additionally, coordinate with the ASF OAuth team to ensure:
+- MFA factor replacement requires in-person identity proofing or equivalent assurance
+- OAuth tokens/claims include `amr` and `acr` fields per [RFC 8176](https://datatracker.ietf.org/doc/html/rfc8176)
+- Account recovery events are flagged in tokens so relying parties can enforce additional verification
+
+---
+
+## Positive Security Patterns
+
+| Pattern | Location | Description |
+|---------|----------|-------------|
+| External Authentication Delegation | `asfquart.auth` throughout `pages.py` | Authentication is delegated to ASF's established OAuth infrastructure rather than implementing custom auth |
+| Role-Based Access Control | `@asfquart.auth.require({R.committer})`, `{R.pmc_member}` | Multiple authorization levels enforced via decorators |
+| Voter Eligibility Verification | `pages.py:255-260`, `election.py:232-240` | Database-backed eligibility checks before vote acceptance |
+| Cryptographic Vote Integrity | `crypto.py`, `election.py:65-78` | Argon2-based tamper detection via `opened_key` |
+| Strong Salt Generation | `crypto.py:28-30` | 16-byte salts via `secrets.token_bytes()` |
+| Per-Voter Cryptographic Separation | `mayvote.salt`, `crypto.gen_vote_token()` | Individual salts prevent cross-voter correlation |
+| Parameterized SQL Queries | `queries.yaml` | All database queries use parameterized placeholders |
+| State Machine Enforcement | `election.py` `is_editable()/is_open()/is_closed()` | Election lifecycle enforced before state-changing operations |
+
+---
+
+## Architecture Observations
+
+1. **Authentication Boundary**: The application operates entirely within a trust-the-IdP model. All authentication decisions are made by the external ASF OAuth provider. The application has no visibility into how the user authenticated, the strength of that authentication, or whether factors were recently recovered.
+
+2. **No Factor Inventory**: The `person` table (`pid`, `name`, `email`) stores no authentication factor metadata. There is no way to track factor enrollment, loss, or replacement events at the application level.
+
+3. **Flat Authorization Model**: Once authenticated with a valid session, the authorization model is purely role-based (`committer` vs `pmc_member`). There is no concept of authentication assurance levels affecting authorization decisions, despite the `authz` field in the `election` table suggesting future group-based permissions.
+
+4. **Session Simplicity**: Sessions carry only identity claims (`uid`, `fullname`, `email`) with no authentication context. This prevents the application from making risk-based decisions about session trustworthiness.
+
+---
+
+## Recommendations Summary
+
+### Immediate Actions
+1. Request `amr`/`acr` claims from ASF OAuth and store in session (Effort: Medium, Impact: High) — Enables MFA verification at application level
+2. Implement `require_mfa` decorator for sensitive operations including voting and election lifecycle management (Effort: Medium, Impact: High) — Prevents access from weakened/recovered sessions
+
+### Short-term Actions
+3. Add session freshness checks requiring re-authentication for critical operations (Effort: Low, Impact: Medium) — Limits exposure window of compromised sessions
+4. Coordinate with ASF IdP team to document factor recovery identity proofing procedures (Effort: Low - process, Impact: Medium) — Ensures NIST 800-63B §6.1.2.3 compliance at the IdP
+
+### Long-term Actions
+5. Add authentication event logging including auth method, time, and factor changes to audit trail (Effort: Medium, Impact: Medium) — Enables post-incident forensic analysis
+
+---
+
+## Appendix: Files Analyzed
+
+<details>
+<summary>Click to expand file list (8 files)</summary>
+
+- `v3/server/pages.py` (relevance: 4)
+- `v3/docs/schema.md` (relevance: 3)
+- `v3/schema.sql` (relevance: 3)
+- `v3/steve/election.py` (relevance: 3)
+- `v3/ARCHITECTURE.md` (relevance: 2)
+- `v3/queries.yaml` (relevance: 2)
+- `v3/steve/crypto.py` (relevance: 2)
+- `v3/steve/persondb.py` (relevance: 2)
+
+</details>
\ 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