|
| 1 | +--- |
| 2 | +Name: Bcp.exe |
| 3 | +Description: Microsoft SQL Server Bulk Copy Program utility for importing and exporting data between SQL Server instances and data files. |
| 4 | +Author: Mahir Ali Khan |
| 5 | +Created: 2025-11-13 |
| 6 | +Commands: |
| 7 | + - Command: bcp "SELECT payload_data FROM database.dbo.payloads WHERE id=1" queryout "C:\Windows\Temp\payload.exe" -S localhost -T -c |
| 8 | + Description: Export binary payload stored in SQL Server database to file system. |
| 9 | + Usecase: Extract malicious executable from database storage to local file system for execution. |
| 10 | + Category: Download |
| 11 | + Privileges: User |
| 12 | + MitreID: T1105 |
| 13 | + OperatingSystem: Windows |
| 14 | +Full_Path: |
| 15 | + - Path: C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\bcp.exe |
| 16 | + - Path: C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\bcp.exe |
| 17 | + - Path: C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\bcp.exe |
| 18 | + - Path: C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\bcp.exe |
| 19 | + - Path: C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\bcp.exe |
| 20 | + - Path: C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\bcp.exe |
| 21 | + - Path: C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\bcp.exe |
| 22 | +Detection: |
| 23 | + - IOC: Process creation of bcp.exe with queryout or Out parameter |
| 24 | + - IOC: bcp.exe writing executable files to temp or users directories |
| 25 | + - IOC: Network connections from bcp.exe to SQL Server followed by file creation |
| 26 | + - IOC: Event ID 4688 - Process creation for bcp.exe |
| 27 | + - IOC: Event ID 4663 - File system access by bcp.exe |
| 28 | + - Sigma: https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_bcp_export_data.yml |
| 29 | +Resources: |
| 30 | + - Link: https://docs.microsoft.com/en-us/sql/tools/bcp-utility |
| 31 | + - Link: https://asec.ahnlab.com/en/61000/ |
| 32 | + - Link: https://asec.ahnlab.com/en/78944/ |
| 33 | + - Link: https://www.huntress.com/blog/attacking-mssql-servers |
| 34 | + - Link: https://www.huntress.com/blog/attacking-mssql-servers-pt-ii |
| 35 | + - Link: https://news.sophos.com/en-us/2024/08/07/sophos-mdr-hunt-tracks-mimic-ransomware-campaign-against-organizations-in-india/ |
| 36 | + - Link: https://research.nccgroup.com/2018/03/10/apt15-is-alive-and-strong-an-analysis-of-royalcli-and-royaldns/ |
| 37 | +Acknowledgement: |
| 38 | + - Person: Mahir Ali Khan |
| 39 | + Handle: '@mahiralikhan07' |
| 40 | +--- |
0 commit comments