Giter VIP home page Giter VIP logo

roottusk / vapi Goto Github PK

View Code? Open in Web Editor NEW
1.1K 18.0 298.0 24.44 MB

vAPI is Vulnerable Adversely Programmed Interface which is Self-Hostable API that mimics OWASP API Top 10 scenarios through Exercises.

License: GNU General Public License v3.0

PHP 9.18% Dockerfile 0.04% Shell 0.14% HTML 90.50% Smarty 0.14%
owasp api apitop10 owasp-top-10 owasp-top-ten vulnerable-application appsec appsec-tutorials bugbounty hacktoberfest

vapi's Introduction

vAPI Tweet

Docker Build Status License: GPL v3 Version PHP Laravel Issues

vAPI is Vulnerable Adversely Programmed Interface which is Self-Hostable API that mimics OWASP API Top 10 scenarios in the means of Exercises.

Requirements

  • PHP
  • MySQL
  • PostMan
  • MITM Proxy

Installation (Docker)

docker-compose up -d

Installation (Manual)

Copying the Code

cd <your-hosting-directory>
git clone https://github.com/roottusk/vapi.git

Setting up the Database

Import vapi.sql into MySQL Database

Configure the DB Credentials in the vapi/.env

Starting MySQL service

Run following command (Linux)

service mysqld start

Starting Laravel Server

Go to vapi directory and Run

php artisan serve

Setting Up Postman

  • Import vAPI.postman_collection.json in Postman
  • Import vAPI_ENV.postman_environment.json in Postman

OR

Use Public Workspace

https://www.postman.com/roottusk/workspace/vapi/

Usage

Browse http://localhost/vapi/ for Documentation

After Sending requests, refer to the Postman Tests or Environment for Generated Tokens

Deployment

Helm can be used to deploy to a Kubernetes namespace. The chart is in the vapi-chart folder. The chart requires one secret named vapi with the following values:

DB_PASSWORD: <database password to use>
DB_USERNAME: <database username to use>

Sample Helm Install Command: helm upgrade --install vapi ./vapi-chart --values=./vapi-chart/values.yaml

*** Important ***

The MYSQL_ROOT_PASSWORD on line 232 in the values.yaml must match that on line 184 in order to work.

Presented At

OWASP 20th Anniversary

Blackhat Europe 2021 Arsenal

HITB Cyberweek 2021, Abu Dhabi, UAE

@Hack, Riyadh, KSA

Upcoming

APISecure.co

Mentions and References

[1] https://apisecurity.io/issue-132-experian-api-leak-breaches-digitalocean-geico-burp-plugins-vapi-lab/

[2] https://dsopas.github.io/MindAPI/references/

[3] https://dzone.com/articles/api-security-weekly-issue-132

[4] https://owasp.org/www-project-vulnerable-web-applications-directory/

[5] https://github.com/arainho/awesome-api-security

[6] https://portswigger.net/daily-swig/introducing-vapi-an-open-source-lab-environment-to-learn-about-api-security

[7] https://apisecurity.io/issue-169-insecure-api-wordpress-plugin-tesla-3rd-party-vulnerability-introducing-vapi/

Walkthroughs/Writeups/Videos

[1] https://cyc0rpion.medium.com/exploiting-owasp-top-10-api-vulnerabilities-fb9d4b1dd471 (vAPI 1.0 Writeup)

[2] https://www.youtube.com/watch?v=0F5opL_c5-4&list=PLT1Gj1RmR7vqHK60qS5bpNUeivz4yhmbS (Turkish Language) (vAPI 1.1 Walkthrough)

[3] https://medium.com/@jyotiagarwal3190/roottusk-vapi-writeup-341ec99879c (vAPI 1.1 Writeup)

Acknowledgements

  • The icon and banner uses image from Flaticon

vapi's People

Contributors

andyg-0 avatar cyc0rpion avatar gilbrea avatar mathew-jose avatar pauloasilva avatar piyushroshan avatar roottusk avatar the301sparton 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

vapi's Issues

I can not run vapi on kali linux

with docker or installing it manually I can not run vapi

bug㉿kali)-[/var/www/html/vapi]
└─$ sudo docker-compose up -d
WARNING: The APP_NAME variable is not set. Defaulting to a blank string.
WARNING: The PUSHER_APP_KEY variable is not set. Defaulting to a blank string.
WARNING: The PUSHER_APP_CLUSTER variable is not set. Defaulting to a blank string.
vapi_db_1 is up-to-date
Starting vapi_www_1 ...
Starting vapi_www_1 ... done

later localhost://vapi and

got

The connection was reset

The connection to the server was reset while the page was loading.

The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

error create user API1

in the old version I managed to go to API5 and it started to give an error.
After the update, When creating the user for testing, i get this feedback in postman;

{
"errorInfo": [
"23000",
1062,
"Duplicate entry '' for key 'a_p_i1_users.username'"
]
}

API3 APK Challenge Hardcoded URL

The APK in the API 3 challenge has a older hard-coded url , user should be able to change the base url before logging in to the application. So an address from Local Network can also be put i.e. 192.x.x.x where the Lab instance is running.

Updating php/apache base image

The php/apache base image in the dockerfile has some known vulnerabilities in it. Upgrading to the latest version(php:8.1.2-apache) removes the vulnerabilities but breaks the code. I have not had time to dig into the errors yet to see what it would take to get it to work with the latest php docker image.

helm chart

This would be an enhancement. Has any thoughts been given to creating a helm chart for deploying to Kubernetes?

Authorization-Tokens are not well documented.

Hello, first, thank you for the great practice API!

I came across vAPI through an API hacking course hosted by APIsec. I, and a lot of other students, are having a lot of fun with it, and learning a lot, but many students have run into a problem with the Authorization-Token header. The documentation at http://localhost/vapi always references ``{{apiX_auth}}` but never specifies what format the auth token is in. I personally took about 4 hours trying to figure it out and eventually looked up this repo, read the README, and realized you have a Postman import then generates these tokens for you.

I've completed the course, and so I've had quite a few other students ask me about this when they get stuck as well. Some students figure it out just by guessing since you essentially use the Authorization: Basic {{base64}} scheme; and those students will ask me how I figured it out, or if they just didn't understand something properly. Then I've seen other students who were also stuck for hours, like me, just give up and ask.

I gave four passes at trying to code beautify vapi/resources/views/index.html to then manually add a section on the auth token format as a PR, but with each attempt, it broke the page styling or JS. I'm not familiar with redoc at all to know if there is a way to put a section at the beginning of the documentation, but if there is would you perhaps add that section? Worst case, though it wouldn't be as immediately obvious, do you think we could add a section about it in the README and vapi/resources/views/welcome.html?

If you want to go for the latter, or you want me to try and add a section without beautifying the index page code, let me know and I don't mind submitting a PR for it. Thank you again for all your work!

VAPI3

please how to configure apk "the Company App"?
configure http://localhost/vapi/
then I tried to register a user on the App but nothing happens!

I noticed that there was an update to the App. In the previous version I logged in with
testuser:test123

vapi APIs are not working locally

Hi,

I am new to API vulnerability checking using vapi. I am using docker-compose to run the vapi application in my local as shown below:
image

The first issue is that I cannot access the documentation of vapi using http://loclahost:8082/vapi even though docker is running.
The second issue, since vapi is running locally, I am using postman to access the APIs and always receive the following error:
image

Would you please provide any help on this? Thanks.

Error 403 when trying to access the mainpage

Good day,

I am still fairly new with Docker, and I am very interested in doing this challenge.

Whenever I run "docker-compose up -d " I do not get any issues, the issues arise when I try to access "http://localhost/vapi/" it gives me a Forbidden error.

I was able to run it before but I do not remember what I did

I'm not sure where to head from there, does anyone know what I can do from here?
I tried to run it as sudo but it did not helped at all.

Thank you

Writeup

Can I add my writeup link here ? I have tried to explain it according to API Security Top 10 2023 for the version 1.3.

api1 authHeader

Hello,
Apologies if this is the wrong place to ask this.
Working on api1 problem currently and when trying to get user it's asking for an authHeader. However, when I create user, it doesn't return one. And there's no login endpoint for api1 either. Is there something I'm missing? Is this part of the task?

Api7-can't Print Flag

getKey.php

if($_SERVER["HTTP_ORIGIN"]=="")
    {
        header("Access-Control-Allow-Origin: *");
    }
    else{
        header("Access-Control-Allow-Origin: ".$_SERVER["HTTP_ORIGIN"]);
        $row["flag"]=base64_decode("ZmxhZ3thcGk3X2U3MWI2NTA3MTY0NWUyNGVkNTBhfQ==");
    }
......
if(mysqli_num_rows($result) > 0)
    {
        http_response_code(200);
        $row=$result->fetch_assoc();
        $row["success"]="true";
        print json_encode($row);
    }
 $result->fetch_assoc() overwrite $row,$row["flag"] is null.

API1 test script not running properly

Hello, I'm not sure if this is the correct place to seek help. As I have been tackling this for a while. I am on API1 challenge and I have successfully created the user with a POST request. The test script is supposed to set an environment variable for {{api1_auth}} as it sends the request from what I understand.
image

When I moved to do GET user request, it seems like the ENV is not set. How can I resolve this? Any advice would be appreciated.
image

mysql env on the laravel pod are not set

After deploying on GKE I constantly received error messages related to the DB when sending requests.
After verifying that it was not connectivity or a DB issue I suspected it is a configuration issue.
I've constantly received an error message:

Access denied for user 'forge'@'' (using password: NO)

I tried to look for the .env file which is supposed to set the correct value into that database.php file but haven't found one.
stumbled upon this StackOverflow thread:
https://stackoverflow.com/questions/42148086/laravel-5-error-sqlstatehy000-1045-access-denied-for-user-forgelocalhost

After changing manually the configuration in the database.php file to the correct values everything started working as it should...

missing secret object tamplate

Hi,

There is a missing secret object in the charts directory.
Without it the deployment fails.
After creating the template manually the deployment succeeds.
Example:

kind: Secret
apiVersion: v1
metadata:
  name: {{ include "vapi.fullname" . }}
data:
  username: {{ .Values.mysql.auth.username }}
  password: {{ .Values.mysql.auth.password | b64enc }}

/docker-entrypoint-initdb.d/my_init_script.sh (helm install)

So this script that is run to initialize the MySQL database in helm install is not completing because the script calls for curl, which is not in the docker image; see logs below.

Create vapi db ...
mysql: [Warning] Using a password on the command line interface can be insecure.
2024-02-06T14:04:04.303299Z 10 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
Curling vapi.sql ...
/docker-entrypoint-initdb.d/my_init_script.sh: line 6: curl: command not found

E: Unable to locate package libzip-dev

The command '/bin/sh -c apt-get update && apt-get install -y libzip-dev && apt-get install -y zlib1g-dev && rm -rf /var/lib/apt/lists/* && docker-php-ext-install zip' returned a non-zero code: 100
ERROR: Service 'www' failed to build : Build failed

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.