Skip to content

SQL_Injection @ /LoginValidator.java #274

@cx-boris-goman

Description

@cx-boris-goman

Checkmarx (SAST): SQL_Injection
Security Issue: Read More about SQL_Injection
Checkmarx Project: cx-boris-goman/borJavaVul
Repository URL: https://github.com/cx-boris-goman/borJavaVul
Branch: main
Scan ID: df63710a-c9c2-4406-9ad7-319bd05458a4


The application's processRequest method executes an SQL query with executeQuery, at line 18 of /LoginValidator.java. The application constructs this SQL query by embedding an untrusted string into the query without proper sanitization. The concatenated string is submitted to the database, where it is parsed and executed accordingly.

An attacker would be able to inject arbitrary syntax and data into the SQL query, by crafting a malicious payload and providing it via the input ""password""; this input is then read by the processRequest method at line 10 of /LoginValidator.java. This input then flows through the code, into a query and to the database server - without sanitization.

This may enable an SQL Injection attack.

Result 1:
Severity: CRITICAL
State: TO_VERIFY
Status: RECURRENT
Attack Vector:

    1. ""password"": /LoginValidator.java[10,44]
    2. getParameter: /LoginValidator.java[10,43]
    3. trim: /LoginValidator.java[10,60]
    4. pass: /LoginValidator.java[10,18]
    5. pass: /LoginValidator.java[18,120]
    6. executeQuery: /LoginValidator.java[18,56]
    Review result in Checkmarx One: SQL_Injection

Result 2:
Severity: CRITICAL
State: TO_VERIFY
Status: RECURRENT
Attack Vector:

    1. ""username"": /LoginValidator.java[9,41]
    2. getParameter: /LoginValidator.java[9,40]
    3. trim: /LoginValidator.java[9,57]
    4. user: /LoginValidator.java[9,15]
    5. user: /LoginValidator.java[18,96]
    6. executeQuery: /LoginValidator.java[18,56]
    Review result in Checkmarx One: SQL_Injection

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions