Client Connects Directly to the Database
The desktop client connects straight to the back-end database, so users can bypass the application and query or change the data directly.
| Severity | High |
| CVSS 3.1 | 8.1 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N Open in the calculator |
| CVSS 4.0 | 8.6 CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-602: Client-Side Enforcement of Server-Side Security |
| OWASP Top 10 | A06:2025 Insecure Design |
| MITRE ATT&CK | T1213.006 Databases, T1565.001 Stored Data Manipulation |
| Category | Insecure Design |
Description
The application uses a two-tier design in which the desktop client connects straight to the back-end database, such as Microsoft SQL Server, Oracle or MySQL, and runs queries itself. The database therefore has to accept connections from every user's workstation, using either a shared account whose credentials are held in the client, or each user's own database or Windows login. Business rules and access restrictions are applied by the client, while the database account it uses is usually granted read and write access to all of the application's tables.
Users can connect to the same database with their own tools, such as SQL Server Management Studio, sqlcmd or the ODBC connection in a spreadsheet, and the restrictions in the client do not apply to them. SQL Server application roles, whose activation password is held in the client, do not change this, because the password can be recovered from the client. Any user of the application, and anyone who obtains the connection details, can therefore read and change data across the whole application regardless of the role they hold in it, typically including other users' records, personal data and financial information, and can alter or delete records in ways that bypass the application's validation and audit trail. Depending on the database account's privileges, the access may also give a route to further compromise of the database server.
The weakness is identified by observing the client's connections, recovering the connection details from its configuration, files or traffic, then connecting to the database directly with a standard tool as a low-privileged application user and reviewing what can be read and changed.
Remediation
Move data access behind a server-side tier that enforces the application's rules:
- Introduce an application server or API that the client calls, which authenticates each user, enforces authorisation and business rules, and alone holds the credentials used to connect to the database. Restrict the database to accept connections only from that tier.
- Until that is in place, use each user's own Windows account rather than a shared login, and grant users
EXECUTEpermission only on stored procedures that apply the application's checks, with no direct access to tables. - Use database features such as row-level security to limit which records each user can reach, and apply least privilege to every database account.
- Where the client must remain two-tier, publish it through a remote application platform, such as Remote Desktop Services, so that only those servers need network access to the database, and block the database port from users' workstations.
- Require encrypted connections to the database, and audit direct access to it.
Confirm the fix by attempting to connect to the database directly from a workstation with a user's credentials, and confirming that the connection is refused or limited to the intended procedures.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.