T09 · Insecure Skill Coding Practices
- Location
prng.md:94- Finding
Arbitrary Code Execution Through Unsafe Evaluation of External Data
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a transparent CTF cryptography reference, but it includes directly reusable account-token, password-cracking, request-flooding, and unsafe install/code examples without enough authorization or isolation boundaries.
Install only if you intend to use it for authorized CTFs, labs, or systems you own or are explicitly allowed to test. Run its tools in a disposable virtual environment or container, review any target-facing requests before execution, avoid using it against real accounts or services without permission, and pin or verify external dependencies before installing them.
prng.md:94Arbitrary Code Execution Through Unsafe Evaluation of External Data
SKILL.md:17Unpinned Python Dependencies Installed From Mutable Package Releases
SKILL.md:32RsaCtfTool Retrieved From an Unpinned Git Repository
modern-ciphers-2.md:503HashClash Retrieved From an Unpinned Git Repository
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
nds
# Identify cipher type
python3 -c "from Crypto.Util.number import *; n=<N>; print(f'bits={n.bit_length()}')"
# RSA quick check
python3 -c "from sympy import factorint; print(factorint(<n>))" # Small factors?
openssl rsa -pubin -in key.pub -text -noout # Extract n, e from PEM
# Quick factorization tools
python3 RsaCtfTool.py -n <n> -e <e> --uncipher <c>
# XOR analysis
python3 -c "from pwn import xor; print(xor(bytes.fromhex('<hex>'), b'flag{'))"
# Hash identification
hashid '<hash>'
hashcat --identify '<hash>'
# SageMath (for lattice/ECC)
sage -c "print(factor(<n>))"
(ct - pt) mod 26. Kasiski examination for unknown key length (GCD of repeated sequence distances)YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
bc.so.6') for system libc
libc.srand(int(time()))
for i in range(16): value = libc.rand() & 0xff # match binary's truncation (e.g., & 0xff for byte) print(value)
**Decrypting XOR-encrypted data (L3akCTF 2024 chonccfile):**
```python
from ctypes import CDLL
from time import time
from pwn import u32, p32
libc_imp = CDLL('./libc.so.6')
libc_imp.srand(int(time()))
# Binary XORs each 4-byte block with rand() output
encrypted_data = b'...' # read from heap/memory
result = b''
for i in range(0, len(encrypted_data), 4):
block = u32(encrypted_data[i:i+4])
libc_imp.rand() # skip delay-related rand() call if binary does extra calls
key = libc_imp.rand()
block ^= key
result += p32(block)
Timing considerations:
time(NULL) has 1-second granularity — start the exploit within the same second as the binaryYARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
bc.so.6') for system libc
libc.srand(int(time()))
for i in range(16): value = libc.rand() & 0xff # match binary's truncation (e.g., & 0xff for byte) print(value)
**Decrypting XOR-encrypted data (L3akCTF 2024 chonccfile):**
```python
from ctypes import CDLL
from time import time
from pwn import u32, p32
libc_imp = CDLL('./libc.so.6')
libc_imp.srand(int(time()))
# Binary XORs each 4-byte block with rand() output
encrypted_data = b'...' # read from heap/memory
result = b''
for i in range(0, len(encrypted_data), 4):
block = u32(encrypted_data[i:i+4])
libc_imp.rand() # skip delay-related rand() call if binary does extra calls
key = libc_imp.rand()
block ^= key
result += p32(block)
Timing considerations:
time(NULL) has 1-second granularity — start the exploit within the same second as the binaryYARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
bc.so.6') for system libc
libc.srand(int(time()))
for i in range(16): value = libc.rand() & 0xff # match binary's truncation (e.g., & 0xff for byte) print(value)
**Decrypting XOR-encrypted data (L3akCTF 2024 chonccfile):**
```python
from ctypes import CDLL
from time import time
from pwn import u32, p32
libc_imp = CDLL('./libc.so.6')
libc_imp.srand(int(time()))
# Binary XORs each 4-byte block with rand() output
encrypted_data = b'...' # read from heap/memory
result = b''
for i in range(0, len(encrypted_data), 4):
block = u32(encrypted_data[i:i+4])
libc_imp.rand() # skip delay-related rand() call if binary does extra calls
key = libc_imp.rand()
block ^= key
result += p32(block)
Timing considerations:
time(NULL) has 1-second granularity — start the exploit within the same second as the binaryYARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
bc.so.6') for system libc
libc.srand(int(time()))
for i in range(16): value = libc.rand() & 0xff # match binary's truncation (e.g., & 0xff for byte) print(value)
**Decrypting XOR-encrypted data (L3akCTF 2024 chonccfile):**
```python
from ctypes import CDLL
from time import time
from pwn import u32, p32
libc_imp = CDLL('./libc.so.6')
libc_imp.srand(int(time()))
# Binary XORs each 4-byte block with rand() output
encrypted_data = b'...' # read from heap/memory
result = b''
for i in range(0, len(encrypted_data), 4):
block = u32(encrypted_data[i:i+4])
libc_imp.rand() # skip delay-related rand() call if binary does extra calls
key = libc_imp.rand()
block ^= key
result += p32(block)
Timing considerations:
time(NULL) has 1-second granularity — start the exploit within the same second as the binaryThe skill instructs the agent/user to run package-manager and system installation commands (pip, apt, brew, git clone) that modify the local environment, but it provides no warning, consent gate, or safer alternative. In an agent context with Bash and internet access, this can lead to unreviewed software installation, dependency drift, and execution of third-party code, increasing supply-chain and environment-integrity risk.
Suspicious Unicode normalization or mixed-script content
The heading and prose claim an ECC public-key weakness, but the code operates on key.n, factors moduli into p and q, and describes decryption with recovered factors—behavior characteristic of RSA modulus compromise, not standard ECC public keys. This is an active contradiction between the documentation and what the example code does.
Suspicious Unicode normalization or mixed-script content
This section gives concrete instructions for predicting password reset tokens on a live server by recovering Python MT state from exposed random outputs and forging a reset URL. Even though framed as CTF content, it is directly transferable to real systems and lacks any warning that such actions must be limited to authorized environments, increasing misuse risk.
The password cracking section provides practical attack sequencing, candidate patterns, and Hashcat modes without any boundary-setting on authorization or the risk of exposing real user credentials. In a skill intended for operational use, this lowers friction for credential attacks outside sanctioned challenge environments.
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
flag = pow(c, real_d, n)
**Key insight:** `phi(p^2) = p*(p-1)`, NOT `(p-1)^2`. When a server validates RSA parameters but uses `(p-1)*(q-1)` without checking `p != q`, setting `p=q` creates a working key that the server will miscompute the private exponent for, causing decryption failure and error-path data leakage.
---
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
def make_request(barrier, modified_sig):
barrier.wait() # Synchronize all processes
requests.post(url, json={"sig": modified_sig})
# Launch 80 processes with unique signature modifications
processes = [Process(target=make_request, args=(barrier, modify_sig(i))) for i in range(80)]
This document is titled and organized as an elliptic-curve attacks reference, but substantial sections cover plain DSA nonce-reuse, DSA limited-k brute force, and MD5-collision-based DSA key recovery, which are not elliptic-curve attacks. While still broadly cryptographic and arguably within the overall skill manifest, they do not match this file's claimed ECC-specific scope.
Most of the file is explanatory text and mathematical example code, but this section introduces direct local process execution via subprocess.run to invoke fastcoll. Spawning external binaries is a materially different capability than documenting or illustrating crypto attack techniques, and it is not clearly warranted by the skill's stated reference-style purpose.