Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a vulnerable API module #670

Merged
merged 31 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1fe14d3
starting API build
digininja Oct 2, 2024
18c38b5
first files
digininja Oct 2, 2024
0f76d3b
Basics are working
digininja Oct 2, 2024
254c11b
All working and documented
digininja Oct 3, 2024
e895a43
missing include
digininja Oct 3, 2024
979265e
low working
digininja Oct 11, 2024
9097c0f
added api versioning
digininja Oct 11, 2024
97cc416
medium and low working
digininja Oct 13, 2024
6e41e1d
RCE and generic options response
digininja Oct 16, 2024
d0cd7f4
better description
digininja Oct 16, 2024
4c3b2ac
starting orders
digininja Nov 8, 2024
d7f2316
low finished
digininja Nov 26, 2024
b53c636
improved help page
digininja Nov 26, 2024
a34389f
medium working
digininja Nov 26, 2024
6e2d8bb
tidy space
digininja Nov 26, 2024
42ea586
orders working
digininja Dec 3, 2024
0f758ac
login controller written and added to orders
digininja Dec 5, 2024
36ab59e
checking content type
digininja Dec 5, 2024
7f15de1
login is now OAUTH2
digininja Dec 6, 2024
cb4793b
refresh token working but no auth
digininja Dec 6, 2024
5f92df7
login tokens are encrypted and will expire
digininja Dec 9, 2024
133ce09
All login stuff working
digininja Dec 10, 2024
677d859
check if decrypt worked ok
digininja Jan 23, 2025
9c193cc
tidying up the levels
digininja Jan 23, 2025
b4d82b1
echo function added
digininja Jan 24, 2025
0d0a7e1
more links
digininja Jan 24, 2025
0577e1d
typo
digininja Jan 24, 2025
9217125
impossible level
digininja Jan 24, 2025
eb475ab
updated composer stuff
digininja Jan 29, 2025
4790347
calling openapi openapi, not swagger
digininja Jan 29, 2025
9cb5f20
how to generate dynamic docs
digininja Jan 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dvwa/includes/dvwaPage.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ function dvwaHtmlEcho( $pPage ) {
}
$menuBlocks[ 'vulnerabilities' ][] = array( 'id' => 'open_redirect', 'name' => 'Open HTTP Redirect', 'url' => 'vulnerabilities/open_redirect/' );
$menuBlocks[ 'vulnerabilities' ][] = array( 'id' => 'encryption', 'name' => 'Cryptography', 'url' => 'vulnerabilities/cryptography/' );
$menuBlocks[ 'vulnerabilities' ][] = array( 'id' => 'api', 'name' => 'API', 'url' => 'vulnerabilities/api/' );
}

$menuBlocks[ 'meta' ] = array();
Expand Down
1 change: 1 addition & 0 deletions vulnerabilities/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor/
10 changes: 10 additions & 0 deletions vulnerabilities/api/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# If the requested resource doesn’t exist, use index.html
#RewriteRule ^ /robin.php
RewriteRule ^ /vulnerabilities/api/public/index.php
#RewriteRule ^ /vulnerabilities/api/public/robin.php
27 changes: 27 additions & 0 deletions vulnerabilities/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# API Info

## Generating OpenAPI Docs

If you want to be able to modify the code and generate your own OpenAPI document you will need to set a few things up.

First, make sure you have Composer installed. There seem to be backward compatibility issues so I always get the latest version from here:

<https://getcomposer.org/doc/00-intro.md>

Follow the instructions the site gives to get it installed.

Now go into `/vulnerabilities/api` directory and run:

```
composer.phar install
```

If you did not install Composer to the system path, make sure you reference its full location.

With this installed, you should now be able to browse to `/vulnerabilities/api/gen_openapi.php` and download a dynamically generated OpenAPI file

## Mark Up

The OpenAPI document is generated using [swagger-php](https://github.com/zircote/swagger-php).

The file is marked up using the newer PHP attributes method, for more information on that, see their [documentation](https://zircote.github.io/swagger-php/guide/attributes.html).
6 changes: 6 additions & 0 deletions vulnerabilities/api/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
require 'vendor/autoload.php';

# use Src\UserController;

# This would set up the database and stuff if needed
10 changes: 10 additions & 0 deletions vulnerabilities/api/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"autoload": {
"psr-4": {
"Src\\": "src/"
}
},
"require": {
"zircote/swagger-php": "^4.10"
}
}
Loading
Loading