Giter Club home page Giter Club logo

sqlinjectionsample's Introduction

SQL Injection Sample

Lucas Rennó Kallás

☀️ This is a simple SQL Injection Sample and you can bypass the login page of this site.

I used Knex with SQLITE3 database.

This repository represents a sample of database fault due to the everyone can abuse the problem of a select in the database and use SQL Injection to connect to an account. This project was made to Database II subject, to test a security failure.

💾 Requirements

▶️ I used Yarn to install packages:

  • YARN.

🔽 Downloads:

Some dependencies to download (with Yarn).

📣 Web:

yarn add react-router-dom @types/react-router-dom yarn add react @types/react yarn add react-dom @types/react-dom yarn add axios @types/axios

📣 Server:

yarn add node @types/node yarn add ts-node-dev -D yarn add knex sqlite3 yarn add typescript -D yarn add cors @types/cors express @types/express

💥 Starting it

⭐ WEB:

Go to the 'web' folder and put:

yarn start

⭐ SERVER:

Go to the 'server' folder and put:

yarn start

🔡 How it works

First start the server and after that start the web in different terminals/command prompts, after that acess 'localhost:3000' in your browser.

The login page will appear like this:

login page

So, find a way to access the next page.

When you have found a way to pass the form, the following message will appear:

success page

Be aware that you can't access the next page just typing it at the page URL, like: 'localhost:3000/admin', if you do this, the following message will appear:

error page

The API host is 'localhost:3333', note that the post method is disabled and the only method available is get. This method receives a query with the username and the password.
You can test some combinations by sending to 'http://localhost:3333/?username=yourUsername&password=yourPass' and the API will return a JSON. Example of the reponse are below.

⛄ FAILURE:

{ "success": 0 }

⚡ SUCCESS:

{ "success": 1 }

🔓 Where is the problem?

Specifically, the problem is in LoginController class at 'server/src/controllers/LoginController.ts'. Get method starts the 'index' function in that class, and this function is just reading the query and putting the data from it at a string that will select something at 'login' table with the username and password which are on the input. If you want to eliminate SQL Injection attacks from the site, just change this file LoginController.ts at these rows:

changes

✌️ Want to test?

  • Make a fork

Good hacking 😉

sqlinjectionsample's People

Contributors

lucasrennok avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.