CWE-1083, Data Access from Outside Expected Data Manager Component, describes a product that is meant to manage data access through one component, such as a relational or NoSQL database layer, but contains code that reads or writes data without using it.
MITRE says that when a product has a data access component, the design may intend all data operations to go through it. An operation outside that component may indicate a violation of the intended design. The entry is marked as a quality issue with no direct security implications and is prohibited for mapping real vulnerabilities.
How it happens
A team builds a repository or data access layer. It holds the connection handling, query construction and checks. Later, a developer in a hurry needs one extra query inside a controller or a report script. The layer does not have the method, so they open a connection directly.
# Vulnerable pattern: a view bypasses the repository layer
def export_report(request):
conn = sqlite3.connect("app.db")
rows = conn.execute("SELECT * FROM users").fetchall()
return render(rows)
The shortcut skips whatever the layer enforces, which may include parameter binding, tenant filters, field masking and audit logging.
# Fix: go through the data layer
def export_report(request):
rows = user_repository.list_for_report(tenant=request.tenant)
return render(rows)
What an attacker gains
Directly, nothing. MITRE lists reduced reliability and says that if the code is reachable by an attacker, the reliability problem might introduce a vulnerability. In practice, the realistic risk is that a bypassing code path lacks a protection the central layer provides, such as a tenant filter or input handling.
How to find it
- Search for direct database driver imports outside the data layer package.
- Add an architecture test that fails if code outside the layer imports the driver.
- Review any raw connection string that appears in application code.
How to fix it
- Decide the single entry point for data access and write it down.
- Add the missing method to the data layer instead of bypassing it.
- Enforce the boundary with import rules or architecture tests.
- Keep security checks inside the layer so every caller gets them.
Quick check
Why does bypassing the data layer matter for security?
The layer is where shared protections usually live. A code path that skips it may skip those protections too, even if nothing is wrong with the layer itself.