Skip to content

Second_Order_SQL_Injection @ /LoginValidator.java #275

@cx-boris-goman

Description

@cx-boris-goman

Checkmarx (SAST): Second_Order_SQL_Injection
Security Issue: Read More about Second_Order_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 changepassword method executes an SQL query with BinaryExpr, at line 40 of /src/main/webapp/vulnerability/csrf/changepassword.jsp. 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.

The attacker may be able to write arbitrary data to the database, which is then retrieved by the application with rs in processRequest method at line 18 of /LoginValidator.java. This data then flows through the code, until it is used directly in the SQL query without sanitization, and then submitted to the database server for execution.

This may enable a Second-Order SQL Injection attack.

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

    1. rs: /LoginValidator.java[18,36]
    2. rs: /LoginValidator.java[19,53]
    3. rs: /LoginValidator.java[22,67]
    4. getString: /LoginValidator.java[22,79]
    5. getAttribute: /src/main/webapp/vulnerability/csrf/changepassword.jsp[15,35]
    6. toString: /src/main/webapp/vulnerability/csrf/changepassword.jsp[15,54]
    7. id: /src/main/webapp/vulnerability/csrf/changepassword.jsp[15,12]
    8. id: /src/main/webapp/vulnerability/csrf/changepassword.jsp[40,83]
    9. BinaryExpr: /src/main/webapp/vulnerability/csrf/changepassword.jsp[40,82]
    Review result in Checkmarx One: Second_Order_SQL_Injection

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

    1. rs: /LoginValidator.java[18,36]
    2. rs: /LoginValidator.java[19,53]
    3. rs: /LoginValidator.java[22,67]
    4. getString: /LoginValidator.java[22,79]
    5. getAttribute: /src/main/webapp/vulnerability/csrf/change-info.jsp[27,34]
    6. toString: /src/main/webapp/vulnerability/csrf/change-info.jsp[27,53]
    7. id: /src/main/webapp/vulnerability/csrf/change-info.jsp[27,11]
    8. id: /src/main/webapp/vulnerability/csrf/change-info.jsp[31,78]
    9. BinaryExpr: /src/main/webapp/vulnerability/csrf/change-info.jsp[31,77]
    Review result in Checkmarx One: Second_Order_SQL_Injection

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

    1. rs: /LoginValidator.java[18,36]
    2. rs: /LoginValidator.java[19,53]
    3. rs: /LoginValidator.java[22,67]
    4. getString: /LoginValidator.java[22,79]
    5. getAttribute: /src/main/webapp/changeCardDetails.jsp[29,34]
    6. toString: /src/main/webapp/changeCardDetails.jsp[29,53]
    7. id: /src/main/webapp/changeCardDetails.jsp[29,11]
    8. id: /src/main/webapp/changeCardDetails.jsp[43,86]
    9. BinaryExpr: /src/main/webapp/changeCardDetails.jsp[43,128]
    Review result in Checkmarx One: Second_Order_SQL_Injection

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

    1. rs: /LoginValidator.java[18,36]
    2. rs: /LoginValidator.java[19,53]
    3. rs: /LoginValidator.java[22,67]
    4. rs: /LoginValidator.java[23,65]
    5. getString: /LoginValidator.java[23,77]
    6. getAttribute: /src/main/webapp/vulnerability/Messages.jsp[14,102]
    7. BinaryExpr: /src/main/webapp/vulnerability/Messages.jsp[14,110]
    Review result in Checkmarx One: Second_Order_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