GithubHelp home page GithubHelp logo

optionalg / joi-security Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kongbytes/joi-security

0.0 1.0 0.0 586 KB

Detect security flaws in Joi validation schemas (XSS, SQL injection, ...) ๐Ÿ”ฅ

License: GNU Affero General Public License v3.0

JavaScript 17.28% TypeScript 82.72%

joi-security's Introduction

Joi security ๐Ÿ”ฅ

This project provides a CLI for offensive and defensive security assesments on the Joi validator library. The goal is to ensure that a given Joi validation shema can resist against known security attacks such as SQL injections, path traversal and SSRF attempts.

Getting started

Install the latest joi-security CLI tool using NPM.

npm install -g joi-security

Create a sample JavaScript file containing the Joi schema below and name it schema.js.

// A sample Joi schema used for login validation
Joi.object().keys({
    username: Joi.string().required(),
    password: Joi.string().required()
});

Scan the JS file using the joi-security scan command.

joi-security scan ./schema.js

Do not include require or return statements in the provided JS file, an export named Joi will be provided. Keep the Joi schema to analyze as last statement in your file, as it will be otherwise ignored.

Web attacks

The joi-security CLI includes by default a wide range of attacks that will be used to test your Joi schemas :

  • XSS including Markdown bypass
  • SQL injections
  • NoSQL injections
  • RCE (Remote Code Execution)
  • LFI (Local File Inclusion)
  • Overflow
  • SSRF
  • Suspicious IP addresses
  • Homograph attacks on domains & emails

Joi security will also attempt to detect the input content based on key names and perform targeted attacks. For example, when matching with potential phone numbers the CLI will try to perform phone-related attacks against the Joi schema.

Credits to the awesome PayloadAllTheThings repository for the advanced attacks.

Options & advanced usage

Changing the output format to HTML, defaults to console output.

joi-security scan ./schema.js --output=web

Each attack may be linked to a set of tags that are displayed below below the payloads (#xss,advanced). Ignore a set of malicious payload tags with the ignore option, which may provide more accurate results.

joi-security scan ./schema.js --ignore=sql,markdown,overflow,aws

Contributing

Clone this project and make sure to have a complete Node installation (including NPM) on your workstation. Please note that this project has currently been tested with Node LTS 12.

# Go inside the Joi security project folder
cd joi-security

# Install all project dependencies
npm install

# Run a first development scan against a Joi schema
npm run dev scan ./sandbox/blogpost-schema.js

Copyright and license

"Joi security" is released under the GNU Affero General Public License. Feel free to suggest a feature, report a bug, or ask something: https://github.com/Saluki/joi-security/issues

joi-security's People

Contributors

saluki avatar dependabot[bot] 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.