CypherMind is a large-language model fine-tuned specifically for Capture-the-Flag (CTF) challenges and cybersecurity tasks.
It assists in solving CTF problems, analyzing security vulnerabilities, reverse engineering, cryptography challenges, and provides step-by-step exploit reasoning while maintaining ethical guidelines and safety constraints.
🚀 Quick Start
bash
1import torch
2import subprocess
3import sys
4import os
5import getpass
67# 1. Install/Update base libraries8# We use '!' to run this as a shell command in the notebook9!pip install --upgrade "llama-cpp-python>=0.2.76""huggingface_hub>=0.25.2"1011# 2. Reinstall llama-cpp-python with CUDA support12if torch.cuda.is_available():
13 print(f"CUDA available: {torch.cuda.get_device_name(0)}")14 print(f"VRAM: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB")1516# Uninstall existing version17 print("\nUninstalling existing llama-cpp-python...")18!{sys.executable} -m pip uninstall -y llama-cpp-python
1920# Reinstall with CUDA flags using the CMAKE_ARGS environment variable21 print("Reinstalling llama-cpp-python with CUDA support...")22# Using '!' ensures the environment variable is correctly set for the shell command23!CMAKE_ARGS="-DGGML_CUDA=on"FORCE_CMAKE=1 pip install llama-cpp-python --force-reinstall --no-cache-dir
2425 print("\n✅ CUDA-enabled installation attempted. Proceed to the next cell.")26else:
27 print("CUDA not available. CPU-only installation used.")28293031import torch
32import os
33import getpass
34from huggingface_hub import login
35from llama_cpp import Llama
3637# 1. Check CUDA one more time (will confirm the environment is ready)38if torch.cuda.is_available():
39 print(f"CUDA available: {torch.cuda.get_device_name(0)} (Confirmed)")40# Set n_gpu_layers to -1 to load ALL layers onto the GPU.41 n_gpu_layers = -1
42else:
43 print("CUDA not available. Running on CPU.")44 n_gpu_layers =04546# 2. Hugging Face Login47HF_TOKEN = os.environ.get("HF_TOKEN") or getpass.getpass("Hugging Face Token: ").strip()48login(token=HF_TOKEN, add_to_git_credential=False)4950# 3. Model Loading51model_id ="ErenAta00/CaptureTheFlag-CypherMindLLM-XRLAB-GGUF"5253print(f"\nLoading model with n_gpu_layers={n_gpu_layers}...")5455llm = Llama.from_pretrained(56repo_id=model_id,
57filename="cyphermind-q6_k.gguf",
58n_ctx=8192,
59n_gpu_layers=n_gpu_layers, # <-- THIS IS NOW SET TO -160verbose=True,
61)6263# 4. Generation Function64def generate(prompt, **kwargs):
65 response = llm.create_chat_completion(66messages=[{"role":"user", "content": prompt}],
67max_tokens=512,
68temperature=0.3,
69top_p=0.9,
70 **kwargs
71)72return response["choices"][0]["message"]["content"]7374# 5. Run75prompt_text ="You are a penetration tester investigating a newly launched e-commerce platform. The platform uses a hidden internal API endpoint, /api/v1/user_data, which is protected by a client-side JavaScript access control mechanism. A quick review of the source code reveals the following comment in a script file: // Note: Authorization is checked client-side, but the API expects a 'user_id' parameter to fetch specific data. Assume the system has 100 users with IDs ranging from 1 to 100. Your task is to exploit this vulnerability by bypassing the client-side check to perform an Insecure Direct Object Reference (IDOR) attack. Specifically, determine the maximum valid user_id that returns the flag hidden within the data of the highest-numbered user. The flag format is FLAG{...}."76print(f"\nPrompt: {prompt_text}")77print("--- Generation Started ---")78print(generate(prompt_text))79print("--- Generation Finished ---")
🏗️ Model Details
Base
Llama-3.1-8B-Instruct
Seq Len
8,192 tokens
Quantization
Q6_K (6-bit)
Languages
EN, TR
✨ Key Features
Capability
Details
CTF Challenge Solving
Analyzes encoded artifacts, reverse engineering tasks, and cryptographic challenges with step-by-step reasoning.
Exploit Reasoning
Performs step-by-step vulnerability analysis (e.g., SQLi, XXE, deserialization) with code-level explanations. Generation of working PoC code.
Security Scenario Analysis
Generates structured security scenarios, attack chain analysis, and defensive strategies.
Log & Artifact Triage
Classifies and summarizes attack traces from SIEM, PCAP, or EDR JSON outputs.
Training Data Sources (curated)
CTF challenge write-ups and solutions from public repositories.
Security research papers and vulnerability analyses (NVD/CVE, VulnDB).
Exploit development tutorials (with safety constraints).
Cryptographic and reverse engineering documentation.