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

Skip to content

Commit 1a5ed61

Browse files
committed
Bug fix (backslash escaping of JSON string values)
1 parent 19925b8 commit 1a5ed61

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

lib/core/agent.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,16 @@ def payload(self, place=None, parameter=None, value=None, newValue=None, where=N
176176

177177
if place in (PLACE.URI, PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER):
178178
_ = "%s%s" % (origValue, kb.customInjectionMark)
179+
179180
if kb.postHint == POST_HINT.JSON and not isNumber(newValue) and '"%s"' % _ not in paramString:
180-
newValue = '"%s"' % newValue
181+
newValue = '"%s"' % self.addPayloadDelimiters(newValue)
181182
elif kb.postHint == POST_HINT.JSON_LIKE and not isNumber(newValue) and "'%s'" % _ not in paramString:
182-
newValue = "'%s'" % newValue
183+
newValue = "'%s'" % self.addPayloadDelimiters(newValue)
184+
else:
185+
newValue = self.addPayloadDelimiters(newValue)
186+
183187
newValue = newValue.replace(kb.customInjectionMark, REPLACEMENT_MARKER)
184-
retVal = paramString.replace(_, self.addPayloadDelimiters(newValue))
188+
retVal = paramString.replace(_, newValue)
185189
retVal = retVal.replace(kb.customInjectionMark, "").replace(REPLACEMENT_MARKER, kb.customInjectionMark)
186190
elif BOUNDED_INJECTION_MARKER in paramDict[parameter]:
187191
retVal = paramString.replace("%s%s" % (origValue, BOUNDED_INJECTION_MARKER), self.addPayloadDelimiters(newValue))

0 commit comments

Comments
 (0)