Skip to content

Sqlmap requires parameters to control the running time of the tamper #5203

Closed

Description

@Margular

When I run sqlmap on portswigger's sql injection lab I found sqlmap requires parameters to control the running time of the tamper:
https://portswigger.net/web-security/sql-injection/lab-sql-injection-with-filter-bypass-via-xml-encoding

My sqlmap command:

sqlmap --batch --tamper htmlencode --force-ssl -v6 -r 1.request

sqlmap sends requests like:

POST /product/stock HTTP/1.1
Host: xxx.web-security-academy.net
Cookie: session=xxx
Content-length: 164

<?xml version="1.0" encoding="UTF-8"?><stockCheck><productId>1&amp;#39;TFsWsa&amp;#60;&amp;#39;&amp;#34;&amp;#62;qCHJXH</productId><storeId>1</storeId></stockCheck>

but what I expect is:

POST /product/stock HTTP/1.1
Host: xxx.web-security-academy.net
Cookie: session=xxx
Content-length: 164

<?xml version="1.0" encoding="UTF-8"?><stockCheck><productId>1&#39;TFsWsa&#60;&#39;&#34;&#62;qCHJXH</productId><storeId>1</storeId></stockCheck>

Can we add a parameter to make the tamper execute after xml encoding?

Activity

  1. stamparm commented on Oct 17, 2022

    @stamparm
    Member
    1. you are having double-encoding problem. "running time" would not help here
    2. i don't have a request file to see what you were trying to do
    3. i am not sure why you tried to use --tamper htmlencode in the first place. i would expect problems like this at your place
  2. Margular commented on Oct 17, 2022

    @Margular
    Author

    the request file is like:

    POST /product/stock HTTP/1.1
    Host: xxx.web-security-academy.net
    Cookie: session=xxx
    Content-length: 164
    
    <?xml version="1.0" encoding="UTF-8"?><stockCheck><productId>1</productId><storeId>1</storeId></stockCheck>
    

    The lab is that WAF intercepts special characters and requires htmlencode encoding to bypass, so I try to use htmlencode tamper to do that, but the double encoding problem of sqlmap makes me unable to achieve my goal

  3. self-assigned this
    on Oct 17, 2022
  4. added this to the 1.7 milestone on Oct 17, 2022
  5. added a commit that references this issue on Jan 30, 2024
    02dcf2a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions