An attacker leverages a weakness present in the database access layer code generated with an Object Relational Mapping (ORM) tool or a weakness in the way that a developer used a persistence framework to inject their own SQL commands to be executed against the underlying database. The attack here is similar to plain SQL injection, except that the application does not use JDBC to directly talk to the database, but instead it uses a data access layer generated by an ORM tool or framework (e.g. Hibernate). While most of the time code generated by an ORM tool contains safe access methods that are immune to SQL injection, sometimes either due to some weakness in the generated code or due to the fact that the developer failed to use the generated access methods properly, SQL injection is still possible.
Description
Attack Execution Flow
Step 1
Explore[Determine Persistence Framework Used] An attacker tries to determine what persistence framework is used by the application in order to leverage a weakness in the generated data access layer code or a weakness in a way that the data access layer may have been used by the developer.
An attacker provides input to the application in an attempt to induce an error screen that reveals a stack trace that gives an indication of the automated data access layer used. Or an attacker may simply make some educated guesses and assume, for instance, that Hibernate is used and try to craft an attack from there.
[Determina il Framework di Persistenza Utilizzato] Un attaccante cerca di determinare quale framework di persistenza viene utilizzato dall'applicazione al fine di sfruttare una vulnerabilità nel codice generato del livello di accesso ai dati o una debolezza nel modo in cui il livello di accesso ai dati potrebbe essere stato utilizzato dallo sviluppatore.
Un attaccante fornisce input all'applicazione nel tentativo di indurre uno schermo di errore che riveli uno stack trace che fornisce un'indicazione del framework di accesso ai dati automatizzato utilizzato. Oppure, un attaccante può semplicemente fare alcune ipotesi informate e supporre, ad esempio, che venga utilizzato Hibernate, e cercare di elaborare un attacco partendo da lì.
Attack Techniques
-
An attacker provides input to the application in an attempt to induce an error screen that reveals a stack trace that gives an indication of the automated data access layer used. Or an attacker may simply make some educated guesses and assume, for instance, that Hibernate is used and try to craft an attack from there.
Step 2
Explore[Probe for ORM Injection vulnerabilities] The attacker injects ORM syntax into user-controllable data inputs of the application to determine if it is possible modify data query structure and content.
[Indaga su vulnerabilità di ORM Injection] L'attaccante inserisce sintassi ORM negli input di dati controllabili dall'utente dell'applicazione per verificare se è possibile modificare la struttura e il contenuto delle query dei dati.
Step 3
Exploit[Perform SQL Injection through the generated data access layer] An attacker proceeds to exploit a weakness in the generated data access methods that does not properly separate control plane from the data plan, or potentially a particular way in which developer might have misused the generated code, to modify the structure of the executed SQL queries and/or inject entirely new SQL queries.
An attacker uses normal SQL injection techniques and adjusts them to reflect the type of data access layer generation framework used by the application.
[Eseguire SQL Injection attraverso il livello di accesso ai dati generato] Un attaccante sfrutta una vulnerabilità nei metodi di accesso ai dati generati che non separano correttamente il control plane dal data plane, o potenzialmente un modo particolare in cui lo sviluppatore potrebbe aver mal utilizzato il codice generato, per modificare la struttura delle query SQL eseguite e/o iniettare nuove query SQL.
Un attaccante utilizza tecniche di SQL injection standard e le adatta in modo da riflettere il tipo di framework di generazione del livello di accesso ai dati utilizzato dall'applicazione.
Attack Techniques
-
An attacker uses normal SQL injection techniques and adjusts them to reflect the type of data access layer generation framework used by the application.