Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL_Injection @ /BookDetail_jsp.java #109

Open
margaritalm opened this issue Sep 27, 2023 · 0 comments
Open

SQL_Injection @ /BookDetail_jsp.java #109

margaritalm opened this issue Sep 27, 2023 · 0 comments

Comments

@margaritalm
Copy link
Owner

margaritalm commented Sep 27, 2023

Checkmarx (SAST): SQL_Injection
Security Issue: Read More about SQL_Injection
Checkmarx Project: margaritalm/BookStore_Small_CLI_small
Repository URL: https://github.com/margaritalm/BookStore_Small_CLI_small
Branch: master
Scan ID: 79dde67e-447e-480d-9f9e-f0bfb2e3e6f8


The application's openrs method executes an SQL query with executeQuery, at line 54 of /BookDetail_jsp.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 paramName; this input is then read by the getParam method at line 163 of /BookDetail_jsp.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: HIGH
State: TO_VERIFY
Status: RECURRENT
Attack Vector:

    1. paramName: /BookDetail_jsp.java[163,37]
    2. getParameter: /BookDetail_jsp.java[163,36]
    3. param: /BookDetail_jsp.java[163,12]
    4. param: /BookDetail_jsp.java[164,27]
    5. param: /BookDetail_jsp.java[165,12]
    6. getParam: /BookDetail_jsp.java[528,28]
    7. pitem_id: /BookDetail_jsp.java[528,9]
    8. pitem_id: /BookDetail_jsp.java[542,36]
    9. value: /BookDetail_jsp.java[212,23]
    10. value: /BookDetail_jsp.java[233,24]
    11. param: /BookDetail_jsp.java[233,16]
    12. param: /BookDetail_jsp.java[245,12]
    13. toSQL: /BookDetail_jsp.java[542,35]
    14. sWhere: /BookDetail_jsp.java[542,7]
    15. sWhere: /BookDetail_jsp.java[545,45]
    16. sSQL: /BookDetail_jsp.java[545,7]
    17. sSQL: /BookDetail_jsp.java[561,28]
    18. sql: /BookDetail_jsp.java[53,61]
    19. sql: /BookDetail_jsp.java[54,47]
    20. executeQuery: /BookDetail_jsp.java[54,46]
    Review result in Checkmarx One: SQL_Injection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant