Skip to content

SLMT/very-secure-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Very Secure Website

Actually, this website is very insecure.

The website is a demostration for some common attacks to web servers.

Requirements

The Versions We Tested

  • Node.js v6.10.3
  • PostgreSQL v9.6.3

Preparation

  1. Create a database on your PostgreSQL server.

  2. Run npm install in this project directory to install dependencies.

  3. Configure config.js in order to connect to your PostgreSQL database.

  4. Run node src/model/schema.js to initialize your database.

  5. Run node src/server.js to start up your server.

  • The web server will be run on port 8080.
  1. Enjoy !

Vulnerability

Here are the vulnerabilities you can try on this website:

SQL Injections

Login as Administrator

Type in admin' -- as username and anything as password on the login form.

View All Tables and Their Columns in The Database

Send a GET request to this URL:

http://127.0.0.1:8080/api/posts?id=-1 UNION SELECT 1, table_name, column_name FROM information_schema.columns WHERE table_schema = 'public';

You can achieve this by simply typing this on the URL bar of your browser.

View All Users' Data

Send a GET request to this URL:

http://127.0.0.1:8080/api/posts?id=-1 UNION SELECT id, username, password FROM users;

You can achieve this by simply typing this on the URL bar of your browser.

Brute-Force Attacks

Brute-Force the Password of the Administrator

Run node util/brute.js

Defense

SQL Injections

To prevent SQL injections, you could use Prepared Statements provided by pg-promise.

Prepared statements clearly separate the SQL command and the data. Therefore, it prevents the client inputs become a part of SQL command.

Brute-Force Attacks

A simple way to prevent brute-force attacks is limit how many times a user can try to login in a given time window. rate-limiter is a good middleware for this job.

References

About

An example website for some common security risks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published