# VulnNodeApp | A Vulnerable Node.Js Application

**URL:** <https://onehack.st/t/vulnnodeapp-a-vulnerable-node-js-application/285279>\
**Category:** Tools & Scripts\
**Tags:** tools, programming, hacking, hosting\
**Created:** [June 24, 2024, 7:18pm UTC](https://onehack.st/t/vulnnodeapp-a-vulnerable-node-js-application/285279 "2024-06-24T19:18:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WhiteHat](https://onehack.st/user_avatar/onehack.st/whitehat/32/162514_2.png) [@WhiteHat](https://onehack.st/u/WhiteHat)\
**Post date:** [June 24, 2024, 7:18pm UTC](https://onehack.st/t/vulnnodeapp-a-vulnerable-node-js-application/285279/1 "2024-06-24T19:18:30Z")

</div>

![image](https://onehack.st/uploads/default/original/3X/2/9/295cace3602d53558f2be6521920e7a75954bd39.jpeg)

# VulnNodeApp

A vulnerable application made using node.js, express server and ejs template engine. This application is meant for educational purposes only.

# Setup

## Clone this repository

git clone [https://github.com/4auvar/VulnNodeApp.git](https://github.com/4auvar/VulnNodeApp.git)

## Application setup:

- Install the latest node.js version with npm.
- Open terminal/command prompt and navigate to the location of downloaded/cloned repository.
- Run command: `npm install`

## DB setup

- Install and configure latest mysql version and start the mysql service/deamon
- Login with root user in mysql and run below sql script:

CREATE USER ‘vulnnodeapp’@‘localhost’ IDENTIFIED BY ‘password’; create database vuln\_node\_app\_db; GRANT ALL PRIVILEGES ON vuln\_node\_app\_db.\* TO ‘vulnnodeapp’@‘localhost’; USE vuln\_node\_app\_db; create table users (id int AUTO\_INCREMENT PRIMARY KEY, fullname varchar(255), username varchar(255),password varchar(255), email varchar(255), phone varchar(255), profilepic varchar(255)); insert into users(fullname,username,password,email,phone) values(“[test1",“test1”,“test1”,"test1@test.com](mailto:test1%22,%22test1%22,%22test1%22,%22test1@test.com)”,“976543210”); insert into users(fullname,username,password,email,phone) values(“[test2",“test2”,“test2”,"test2@test.com](mailto:test2%22,%22test2%22,%22test2%22,%22test2@test.com)”,“9887987541”); insert into users(fullname,username,password,email,phone) values(“[test3",“test3”,“test3”,"test3@test.com](mailto:test3%22,%22test3%22,%22test3%22,%22test3@test.com)”,“9876987611”); insert into users(fullname,username,password,email,phone) values(“[test4",“test4”,“test4”,"test4@test.com](mailto:test4%22,%22test4%22,%22test4%22,%22test4@test.com)”,“9123459876”); insert into users(fullname,username,password,email,phone) values(“[test5",“test5”,“test5”,"test5@test.com](mailto:test5%22,%22test5%22,%22test5%22,%22test5@test.com)”,“7893451230”);

## Set basic environment variable

- User needs to set the below environment variable.
  - DATABASE\_HOST (E.g: localhost, 127.0.0.1, etc…)
  - DATABASE\_NAME (E.g: vuln\_node\_app\_db or DB name you change in above DB script)
  - DATABASE\_USER (E.g: vulnnodeapp or user name you change in above DB script)
  - DATABASE\_PASS (E.g: password or password you change in above DB script)

# Start the server

- Open the command prompt/terminal and navigate to the location of your repository
- Run command: `npm start`
- Access the application at [http://localhost:3000](http://localhost:3000/)

# Vulnerability covered

- SQL Injection
- Cross Site Scripting (XSS)
- Insecure Direct Object Reference (IDOR)
- Command Injection
- Arbitrary File Retrieval
- Regular Expression Injection
- External XML Entity Injection (XXE)
- Node js Deserialization
- Security Misconfiguration
- Insecure Session Management

# TODO

- Will add new vulnerabilities such as CORS, Template Injection, etc…
- Improve application documentation

# Issues

- In case of bugs in the application, feel free to create an [issues](https://github.com/4auvar/VulnNodeApp/issues) on github.

# Contribution

- Feel free to create a pull request for any contribution.

You can reach me out at [@4auvar](https://twitter.com/4auvar)

## GitHub:

> **[GitHub - 4auvar/VulnNodeApp: A vulnerable node.js application](https://github.com/4auvar/VulnNodeApp)**
>
> A vulnerable node.js application
