Skip to main content0xAdham

Command Palette

Search for a command to run...

TAMU CTF 2025 — pittrap: Black-Box ONNX Neural Network Optimization

Written by
Avatar of 0xAdham
0xAdham
Published on
--
TAMU CTF 2025 — pittrap: Black-Box ONNX Neural Network Optimization

Challenge Overview

CTF: TAMU CTF 2025 (gigem) Category: Misc / Rev Challenge: pittrap

The challenge gave us an ONNX neural network model with no source, no architecture diagram, and one job: find the input that makes it output something specific. Classic black-box optimization problem.

Initial Recon

First thing — inspect what we're working with:

Output told us the expected input shape and the output format. The model takes a fixed-length float vector and outputs a score. Goal: maximize (or hit a threshold on) that score.

No gradients available — it's ONNX, inference only. No white-box access.

The Approach: Simulated Annealing

Since we can't backpropagate, we treat the model as a pure oracle: feed it inputs, read the output score, iterate.

Simulated annealing is perfect here:

  • Explores the input space without getting trapped in local minima
  • Accepts worse solutions with decreasing probability over time
  • No gradient required

Getting the Flag

Once the score crossed the threshold the model was checking for, the challenge server returned the flag. The model was essentially a learned classifier — it was trained to recognize a specific "correct" input pattern, and SA found it through pure exploration.

Key Takeaways

  • ONNX inference-only models are black boxes — treat them like APIs, not source code
  • Simulated annealing beats random search significantly for continuous input spaces
  • Cooling schedule matters — too fast and you get stuck, too slow and you waste time
  • Start with a wide step_size and narrow it as temperature drops for better convergence

— 0xAdham | RootRunners

Edit on GitHub
Last updated: --