ml-model-extraction
하는 일
이 스킬은 머신러닝 예측 서비스의 두 가지 위험인 모델 복제와 멤버십 추론을 다룹니다. 배포된 자체 모델의 개인정보 보호와 비밀 유지를 테스트하려는 팀을 위한 스킬입니다.
사용하는 경우
- ✓팀이 예측 API의 답변으로 모델이 복사될 수 있는지 테스트해 달라고 요청할 때.
- ✓에이전트가 학습에 쓰인 기록이 모델의 출력으로 탐지될 수 있는지 확인해야 할 때.
- ✓개인정보 보고서에 모델이 학습 데이터를 얼마나 잘 보호하는지 설명해야 하는 경우.
스킬 링크
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/ml-model-extraction/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“우리 예측 API가 모델을 복사하거나 학습 기록을 드러낼 만큼 충분한 정보를 누출하는지 테스트해 주시겠어요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 입력과 출력 형식을 파악하고, 승인된 범위 안에서 통제된 질의를 보내며, 복제본이 원본과 얼마나 비슷한지 측정합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
ML Model Extraction and Membership Inference
Two closely related attacks against deployed ML prediction APIs:
- Model extraction (stealing): reconstruct a functionally equivalent clone of the target model using only its input/output pairs, without access to weights, architecture, or training data. (Tramer et al. 2016, "Stealing Machine Learning Models via Prediction APIs")
- Membership inference: determine whether a specific record was used to train the target model, breaching training-data confidentiality. (Shokri et al. 2017, "Membership Inference Attacks Against Machine Learning Models")
These are distinct from LLM prompt-extraction attacks: the target is a classical ML model (logistic regression, decision tree, DNN) or an ML-as-a-service endpoint (AWS SageMaker, GCP AutoML, Azure ML, custom REST API).
Authorized use only. Query-volume attacks against commercial ML APIs may violate terms of service, the CFAA, and GDPR Article 22. Confirm scope includes data-privacy testing of the prediction endpoint before proceeding.
ATT&CK Mapping
| Technique | Use |
|---|---|
| T1213 — Data from Information Repositories | Reconstructing training data via repeated model queries |
| T1119 — Automated Collection | Systematic API querying to build a clone dataset |
| T1590 — Gather Victim Network Information | Fingerprinting the ML service to determine model family |
1. Reconnaissance — profile the target API
# 1a. Determine output type
curl -s -X POST "$API/predict" -d '{"features": [0,0,0]}' | jq .
# Does it return: hard label only? Confidence scores? Probability distributions?
# Probabilities = highest information; enables equation-solving extraction
# 1b. Infer model type from decision-boundary shape
# Binary classifier: probe boundary by linear interpolation between two known-class samples
# Multi-class: vary one feature at a time, record where predicted class changes
# Decision-tree vs smooth boundary: tree-type models have axis-aligned boundaries
# 1c. Count features and valid ranges from API docs / error messages
curl -s -X POST "$API/predict" -d '{}' | jq .error
# Validation errors often expose expected feature names and types
# 1d. Estimate query budget (cost / rate limit)
# Most commercial APIs: ~$0.0001–0.001 per query; 10k–1M queries typical for extraction
2. Model extraction
2a. Equation-solving attack (logistic/linear models)
For models returning exact probability scores, d features → d+1 queries suffice (Tramer):
import numpy as np
from scipy.optimize import fsolve
def extract_logreg(query_fn, n_features, n_classes):
"""
Solve for weight matrix W using the system of equations:
softmax(W @ x_i) = query_fn(x_i)
n_features * n_classes unknowns, solved via n_features * n_classes + 1 queries.
"""
queries = [np.random.randn(n_features) for _ in range(n_features * n_classes + 1)]
scores = [query_fn(q) for q in queries] # shape: (n_queries, n_classes)
# Fit a local logistic regression to (queries, scores) using soft targets
from sklearn.linear_model import LogisticRegression
surrogate = LogisticRegression(multi_class='multinomial', max_iter=1000)
labels = [np.argmax(s) for s in scores]
surrogate.fit(queries, labels)
return surrogate # clone with equivalent decision boundary
# Verify: clone accuracy vs target on held-out natural inputs should be >95%
2b. Path-finding attack (decision trees)
Decision trees are fully recoverable with O(n_leaves * depth) queries via adaptive path traversal:
def extract_decision_tree(query_fn, feature_bounds, max_depth=10):
"""
Recursively find split thresholds by binary search.
For each feature, probe the boundary where the predicted class changes.
"""
from sklearn.tree import DecisionTreeClassifier
X_queries, y_labels = [], []
# Adaptive sampling: grid + boundary refinement
for _ in range(5000):
x = np.random.uniform(feature_bounds[:, 0], feature_bounds[:, 1])
y = np.argmax(query_fn(x))
X_queries.append(x)
y_labels.append(y)
surrogate = DecisionTreeClassifier(max_depth=max_depth)
surrogate.fit(X_queries, y_labels)
return surrogate
2c. Neural network surrogate (DNN, general)
For deep models, train a surrogate network on (query, prediction) pairs using soft labels:
import torch, torch.nn as nn
def extract_dnn_surrogate(query_fn, i
자주 묻는 질문
모델 추출이란 무엇인가요?
가중치에 접근하지 않고, 입력과 출력만으로 작동하는 복사본을 만드는 것입니다.
멤버십 추론이란 무엇인가요?
특정 기록이 모델 학습에 쓰였는지 확인하는 것이며, 이는 개인 데이터를 드러낼 수 있습니다.
이 테스트에 제한이 있나요?
네. 스킬은 대량의 질의 테스트가 서비스 약관이나 개인정보 보호법을 위반할 수 있으므로, 먼저 범위를 확인해야 한다고 설명합니다.
상세 정보
작성자의 원본 설명
Extract a functional clone of a black-box ML model via prediction API queries, and infer whether specific records were in the training set (membership inference).
인기도
- GitHub 스타
- 6.5k
- 순위
- #13962
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
detector-overview
6.5k에이전트가 스캐너가 표시한 코드를 읽고, 표시된 곳 중 어디가 실제 보안 버그이고 어디가 오탐인지 판단하도록 돕습니다.
exploiter-overview
6.5k에이전트가 확인된 여러 보안 약점을 하나의 테스트 체인으로 묶고, 그 체인이 어디까지 닿을 수 있는지 확인하도록 돕습니다.
llm-redteam-overview
6.5k에이전트가 프롬프트 인젝션부터 모델 악용까지 15개 전술 그룹 중 테스트에 맞는 AI 레드팀 가이드를 찾도록 돕습니다.
aatmf-t01-prompt-injection
6.5k숨겨진 지시가 AI 시스템을 덮어쓰려 하는 프롬프트 인젝션을 설명해, 보안 테스터가 이를 점검할 수 있게 합니다.