GithubHelp home page GithubHelp logo

appsecco / dvna Goto Github PK

View Code? Open in Web Editor NEW
683.0 26.0 675.0 3.18 MB

Damn Vulnerable NodeJS Application

License: MIT License

JavaScript 8.64% Shell 1.87% Dockerfile 0.08% Less 33.82% SCSS 34.26% EJS 21.33%
nodejs dvna vulnerable-apps vulnerable security owasp-top-10 owasp hack testing

dvna's Introduction

Damn Vulnerable NodeJS Application (DVNA)

dvna-logo

Damn Vulnerable NodeJS Application (DVNA) is a simple NodeJS application to demonstrate OWASP Top 10 Vulnerabilities and guide on fixing and avoiding these vulnerabilities. The fixes branch will contain fixes for the vulnerabilities. Fixes for vulnerabilities OWASssP Top 10 2017 vulnerabilities at fixes-2017 branch.

The application is powered by commonly used libraries such as express, passport, sequelize, etc.

Developer Security Guide book

The application comes with a developer friendly comprehensive guidebook which can be used to learn, avoid and fix the vulnerabilities. The guide is available at docs and covers the following

  1. Instructions for setting up DVNA
  2. Instructions on exploiting the vulnerabilities
  3. Vulnerable code snippets and instructions on fixing vulnerabilities
  4. Recommendations for avoid such vulnerabilities
  5. References for learning more

The blog post for this release is at https://blog.appsecco.com/damn-vulnerable-nodejs-application-dvna-by-appsecco-7d782d36dc1e

You can setup a local gitbook server to access the documentation using the following commands. The documentation will then be accessible on http://localhost:4000.

cd docs/
docker run --rm -v `pwd`:/gitbook -p 4000:4000 --name gitbook amontaigu/gitbook gitbook serve

Quick start

Try DVNA using a single command with Docker. This setup uses an SQLite database instead of MySQL.

docker run --name dvna -p 9090:9090 -d appsecco/dvna:sqlite

Access the application at http://127.0.0.1:9090/

Getting Started

DVNA can be deployed in three ways

  1. For Developers, using docker-compose with auto-reload on code updates
  2. For Security Testers, using the Official image from Docker Hub
  3. For Advanced Users, using a fully manual setup

Detailed instructions on setup and requirements are given in the Guide Gitbook

1. Development Setup

Clone this repository

git clone https://github.com/appsecco/dvna; cd dvna

Create a vars.env with the desired database configuration

MYSQL_USER=dvna
MYSQL_DATABASE=dvna
MYSQL_PASSWORD=passw0rd
MYSQL_RANDOM_ROOT_PASSWORD=yes

Start the application and database using docker-compose

docker-compose up

Access the application at http://127.0.0.1:9090/

The application will automatically reload on code changes, so feel free to patch and play around with the application.

Using Official Docker Image

Create a file named vars.env with the following configuration

MYSQL_USER=dvna
MYSQL_DATABASE=dvna
MYSQL_PASSWORD=passw0rd
MYSQL_RANDOM_ROOT_PASSWORD=yes
MYSQL_HOST=mysql-db
MYSQL_PORT=3306

Start a MySQL container

docker run --rm --name dvna-mysql --env-file vars.env -d mysql:5.7

Start the application using the official image

docker run --rm --name dvna-app --env-file vars.env --link dvna-mysql:mysql-db -p 9090:9090 appsecco/dvna

Access the application at http://127.0.0.1:9090/ and start testing!

Manual Setup

Clone the repository

git clone https://github.com/appsecco/dvna; cd dvna

Configure the environment variables with your database information

export MYSQL_USER=dvna
export MYSQL_DATABASE=dvna
export MYSQL_PASSWORD=passw0rd
export MYSQL_HOST=127.0.0.1
export MYSQL_PORT=3306

Install Dependencies

npm install

Start the application

npm start

Access the application at http://localhost:9090

TODO

  • Link commits to fixes in documentation
  • Add new vulnerabilities from OWASP Top 10 2017
  • Improve application features, documentation

Contributing

In case of bugs in the application, please create an issue on github. Pull requests are highly welcome!

Thanks

Abhisek Datta - abhisek for application architecture and front-end code

License

MIT

dvna's People

Contributors

0xbharath avatar audibleblink avatar madhuakula avatar riyazwalikar avatar shivankar-madaan avatar sns-temp avatar subashsn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dvna's Issues

The "Quick start" section in README.md doesn't make it clear on how to use DVNA with MySQL and SQLite

The command in "Quick start" section in README.md starts DVNA with SQLite but the "Getting Started" section describes DVNA with MySQL. This leads to confusion when testing the application as the injection attacks are different for both versions. It would be very helpful if the README.md has clear and distinct instructions for starting DVNA with MySQL and SQLite.

Please let me know if you need help with modifying the README.md

Node.js Carbon is now EOL

The Carbon LTS release is now EOL.
It would be nice to push a new release to DockerHub based on a supported LTS version of node.

MySQL connection error

Hi,

I followed the instructions to setup the DVNA using the official docker file.

When I run the docker image I get the following error.

``wait-for-it.sh: waiting 300 seconds for mysql-db:3306
wait-for-it.sh: mysql-db:3306 is available after 0 seconds

[email protected] start /app
node server.js

Fri, 23 Mar 2018 12:05:06 GMT sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators at node_modules/sequelize/lib/sequelize.js:236:13
Unable to connect to the database: { SequelizeAccessDeniedError: Access denied for user 'dvna'@'172.17.0.3' (using password: YES)
at Utils.Promise.tap.then.catch.err (/app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:141:19)
at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/app/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/app/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
name: 'SequelizeAccessDeniedError',
parent:
{ Error: Access denied for user 'dvna'@'172.17.0.3' (using password: YES)
at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:713:13)
at ClientHandshake.Command.execute (/app/node_modules/mysql2/lib/commands/command.js:28:22)
at Connection.handlePacket (/app/node_modules/mysql2/lib/connection.js:515:28)
at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:94:16)
at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket. (/app/node_modules/mysql2/lib/connection.js:102:29)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '28000',
sqlMessage: 'Access denied for user 'dvna'@'172.17.0.3' (using password: YES)' },
original:
{ Error: Access denied for user 'dvna'@'172.17.0.3' (using password: YES)
at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:713:13)
at ClientHandshake.Command.execute (/app/node_modules/mysql2/lib/commands/command.js:28:22)
at Connection.handlePacket (/app/node_modules/mysql2/lib/connection.js:515:28)
at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:94:16)
at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket. (/app/node_modules/mysql2/lib/connection.js:102:29)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '28000',
sqlMessage: 'Access denied for user 'dvna'@'172.17.0.3' (using password: YES)' } }
An error occurred while creating the table: { SequelizeAccessDeniedError: Access denied for user 'dvna'@'172.17.0.3' (using password: YES)
at Utils.Promise.tap.then.catch.err (/app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:141:19)
at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/app/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/app/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
name: 'SequelizeAccessDeniedError',
parent:
{ Error: Access denied for user 'dvna'@'172.17.0.3' (using password: YES)
at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:713:13)
at ClientHandshake.Command.execute (/app/node_modules/mysql2/lib/commands/command.js:28:22)
at Connection.handlePacket (/app/node_modules/mysql2/lib/connection.js:515:28)
at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:94:16)
at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket. (/app/node_modules/mysql2/lib/connection.js:102:29)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '28000',
sqlMessage: 'Access denied for user 'dvna'@'172.17.0.3' (using password: YES)' },
original:
{ Error: Access denied for user 'dvna'@'172.17.0.3' (using password: YES)
at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:713:13)
at ClientHandshake.Command.execute (/app/node_modules/mysql2/lib/commands/command.js:28:22)
at Connection.handlePacket (/app/node_modules/mysql2/lib/connection.js:515:28)
at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:94:16)
at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket. (/app/node_modules/mysql2/lib/connection.js:102:29)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '28000',
sqlMessage: 'Access denied for user 'dvna'@'172.17.0.3' (using password: YES)' } }

Invalid Credentials

I've followed the commands to set up DVNA and it doesn't seem to be installing correctly.
I've tried all methods of installation.
The default credentials don't seem to have been set up and I get the following error when I try to log in:

Invalid Credentials

I've connected to the docker MySQL database and it's empty.
Can anybody tell me what I'm missing?

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.