diff --git a/public/index.php b/public/index.php index ee0df84..bc5b589 100644 --- a/public/index.php +++ b/public/index.php @@ -114,6 +114,8 @@ require __DIR__ . '/../src/app/vulnerabilities/source-disclosure.php'; require __DIR__ . '/../src/app/vulnerabilities/info-disclosure.php'; require __DIR__ . '/../src/app/vulnerabilities/mass-assignment.php'; +require __DIR__ . '/../src/app/vulnerabilities/publicEndpoint.php'; +require __DIR__ . '/../src/app/vulnerabilities/basicresponsemanipulation.php'; // False positives section diff --git a/src/app/login/hypejablogin.php b/src/app/login/hypejablogin.php index fbcd8a8..eb061a3 100644 --- a/src/app/login/hypejablogin.php +++ b/src/app/login/hypejablogin.php @@ -137,10 +137,23 @@ function (Request $request, Response $response) { } $key = 'my_secret_astra_key'; + $tokenData = [ + "user_id" => 123, + "username" => "exampleuser", + "scope" => "limited" + ]; + + $actualToken = [ + "user_id" => 123, + "username" => "exampleuser", + "panCard" => "AKYSG1973G" + ]; + + $bodytoken = JWT::encode($tokenData, $key, 'HS256'); try { $decoded = JWT::decode($token, new Key($key, 'HS256')); - $response->getBody()->write('
Access Granted. Decoded Data: ' . json_encode($decoded) . '
'); + $response->getBody()->write('Access Granted. Decoded Data: ' . json_encode($actualToken) . '
'); return $response->withHeader("content-type", "text/html") ->withStatus(200); } catch (Exception $e) { diff --git a/src/app/vulnerabilities/basicresponsemanipulation.php b/src/app/vulnerabilities/basicresponsemanipulation.php new file mode 100644 index 0000000..c55bb91 --- /dev/null +++ b/src/app/vulnerabilities/basicresponsemanipulation.php @@ -0,0 +1,18 @@ +get( + '/response', + function (Request $request, Response $response) { + $data = [ + 'success' => true, + ]; + $dataJson = json_encode($data, JSON_PRETTY_PRINT); + $response->getBody()->write($dataJson); + return $response->withHeader("content-type", "application/json") + ->withStatus(200); + } +); \ No newline at end of file diff --git a/src/app/vulnerabilities/publicEndpoint.php b/src/app/vulnerabilities/publicEndpoint.php new file mode 100644 index 0000000..5ab19ec --- /dev/null +++ b/src/app/vulnerabilities/publicEndpoint.php @@ -0,0 +1,29 @@ +get('/public-endpoint', function (Request $request, Response $response) { + $data = [ + "hello" => "world" + ]; + $json_data = json_encode($data, JSON_PRETTY_PRINT); + $response->getBody()->write($json_data); + return $response->withHeader("content-type", "application/json") + ->withStatus(200); +}); + +$app->post('/public-endpoint', function (Request $request, Response $response) { + $response->getBody()->write(' + hello public'); + return $response->withHeader("content-type", "text/html") + ->withStatus(200); +}); + +$app->options('/public-endpoint', function (Request $request, Response $response) { + $response->getBody()->write(''); + return $response->withHeader("content-type", "text/html") + ->withHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS") + ->withStatus(200); +}); \ No newline at end of file