How to Bypass Filter in SQL Injection Manually

How to Bypass Filter in SQL Injection Manually

In previous article you have learned the basic concepts of SQL injection but in some scenarios you will find that your basic knowledge and tricks will fail. The reason behind that is the protection that developer had applied to prevent SQL injection, sometimes developer use filters to strip out few characters and OPERATORS from the user input before adding it to the query for SQL statement to prevent SQL Injection. Today’s article will help you to face such situations and will tell you how to bypass such filters. Here again we’ll be using DHAKKAN SQLI labs for practice.

 Let’s start!!

 LESSION 25

In Lab 25 OR and AND function are Blocked here we will try to bypass sql filter using their substitute.

function blacklist($id)

$id= preg_replace(‘/or/i’,””, $id);                             //strip out OR (non case sensitive)

$id= preg_replace(‘/AND/i’,””, $id);                        //Strip out AND (non case sensitive)

Since alphabetic word OR, AND are blacklisted, hence if we use AND 1=1 and OR 1=1 there would be no output therefore I had use %26%26 inside the query.

 Following are replacement for AND and OR

AND :  &&  %26%26 

OR : || 

Open the browser and type following SQL query in URL

http://localhost:81/sqli/Less-25/?id=1′ %26%26 1=1 –+

From screenshot you can see we have successfully fixed the query for AND (&&) into URL encode as %26%26. Even when AND operator was filtered out.

Full Article Read here

To view or add a comment, sign in

More articles by Rajpal Singh

  • Born2Root: 2: Vulnhub Walkthrough

    Hello Friends!! Today we are going to take another CTF challenge named “Born2Root: 2”. The credit for making this VM…

    1 Comment
  • dnscat2: Command and Control over the DNS

    In this article, we learn DNS tunnelling through an amazing tool i.e.

    9 Comments
  • HackInOS:1: Vulnhub Lab Walkthrough

    Hello friends! Today we are going to take another boot2root challenge known as “HackInOS: 1”. The credit for making…

    2 Comments
  • unknowndevice64: 1: Vulnhub Lab Walkthrough

    Hello friends! Today we are going to take another boot2root challenge known as “unknowndevice64: 1”. The credit for…

  • Hack the Box Access: Walkthrough

    Today we are going to solve another CTF challenge “Access”. It is a retired vulnerable lab presented by Hack the Box…

    2 Comments
  • Vulnhub: RootThis: 1 Walkthrough

    Hello friends! Today we are going to take another boot2root challenge known as root this. The credit for making this VM…

  • Vulnhub: Kuya: 1 Walkthrough

    Today we are going to solve another CTF challenge “Kuya”. It is another vulnerable lab presented by vulnhub for helping…

  • Matrix 2: Vulnhub Lab Walkthrough

    Today we are going to solve another Boot2Root challenge “Matrix 2”. It is another vulnerable lab presented by vulnhub…

    1 Comment
  • W34kn3ss 1: Vulnhub Lab Walkthrough

    Today we are going to solve another CTF challenge “W34kn3ss 1”. Briefing about the lab, the matrix is controlling this…

  • Pentest Lab Setup on Memcached

    In this article, we are going to learn about pen-testing in Memcached lab setup in Ubuntu 18.04.

Insights from the community

Others also viewed

Explore topics