[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,91 +2,266 @@
|
||||
id: wiki-2026-0508-binary-author-identification
|
||||
title: Binary Author Identification
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-BAID-001]
|
||||
aliases: [binary attribution, code stylometry, malware authorship, GAN-detect, AI-vs-human code]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.91
|
||||
tags: [auto-reinforced, binary-Analysis, code-stylometry, security, author-identification, ml-security, de-compilation]
|
||||
source_trust_level: B
|
||||
confidence_score: 0.85
|
||||
verification_status: applied
|
||||
tags: [security, forensics, binary-analysis, stylometry, malware-attribution, ai-vs-human-code, attribution]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: Python
|
||||
framework: angr / radare2 / Ghidra / scikit-learn / PyTorch
|
||||
---
|
||||
|
||||
# [[Binary-Author-Identification|Binary-Author-Identification]]
|
||||
# Binary Author Identification
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "디지털 지문 추적: 기계어(Binary)로 번역되어 개성이 사라진 줄 알았던 코드 속에서도, 코딩 습관과 라이브러리 사용 패턴 등 개발자 고유의 '스타일'을 AI가 감지해내어 원래 누가 짠 코드인지 찾아내는 보안 포렌식 기술."
|
||||
## 📌 한 줄 통찰
|
||||
> **"매 digital fingerprint"**. 매 compiled binary 의 매 author style 의 detect. 매 control flow + 매 register usage + 매 idiom 의 unique. 매 malware forensic 의 critical. 매 modern: 매 "human vs AI-generated code" 의 detect.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
바이너리 저자 식별(Binary-Author-Identification)은 컴파일된 실행 파일에서 소스 코드의 저자를 특정하는 연구 분야입니다. (Caliskan-Islam 등의 연구가 대표적)
|
||||
## 📖 핵심
|
||||
|
||||
1. **핵심 기법**:
|
||||
* **Feature Extraction**: 제어 흐름 그래프(CFG), 함수 호출 빈도, 레지스터 사용 패턴 등 바이너리 수준의 특징 추출.
|
||||
* **Stylometric Analysis**: 가변수 이름이 사라진 상태에서도 남아있는 고유한 '코드 스타일 지문' 분석.
|
||||
* **Deep Learning**: 바이너리 시퀀스를 임베딩하여 유사도를 측정하는 신경망 모델 적용. ([[Representation-Learning|Representation-Learning]]와 연결)
|
||||
2. **왜 중요한가?**:
|
||||
* 악성코드 제작자 추적, 오픈소스 저작권 도용 적발 등 사이버 보안 포렌식 분야에서 결정적인 증거를 제공하기 때문임. (Risk-[[Management|Management]]와 연결)
|
||||
### 매 Caliskan-Islam et al. (2015 / 2018)
|
||||
- 매 stylometric features 의 binary 의 maintain.
|
||||
- 매 100 author 의 96% accuracy.
|
||||
- 매 even after compilation + optimization.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 과거에는 컴파일러 최적화 정책([[Optimization|Optimization]])이 스타일을 모두 날려버려 식별이 불가능하다고 믿었으나, 현대 AI 정책은 최적화 후에도 남는 미세한 편향성 정책(Bias)을 잡아내는 데 성공함(RL Update).
|
||||
- **정책 변화(RL Update)**: 최근에는 AI 가 코드를 짜는 시대(GitHub Copilot 등)가 오면서, 사람이 짠 코드와 AI 가 짠 코드를 구분하거나 특정 AI 모델의 스타일을 식별하는 연구 정책으로 확장 중임.
|
||||
### 매 feature
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Risk-Management|Risk-Management]], [[Representation-Learning|Representation-Learning]], Security, [[Source-Control|Source-Control]], [[Feature-Engineering|Feature-Engineering]]
|
||||
- **Key [[Research|Research]]ers**: Aylin Caliskan, Arvind Narayanan.
|
||||
---
|
||||
#### Source-level (binary recovered)
|
||||
- 매 indentation, 매 brace style.
|
||||
- 매 variable naming convention.
|
||||
- 매 keyword frequency.
|
||||
- 매 operator preference.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
#### Binary-level
|
||||
- 매 Control Flow Graph (CFG) 구조.
|
||||
- 매 function call sequence.
|
||||
- 매 register usage pattern.
|
||||
- 매 instruction frequency (n-gram).
|
||||
- 매 calling convention.
|
||||
- 매 padding / alignment.
|
||||
- 매 import library 의 set.
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
#### Decompilation-aided
|
||||
- 매 Ghidra / IDA 의 reverse → source approximation.
|
||||
- 매 stylometric on decompiled.
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### 매 ML approach
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
#### Classical
|
||||
- **Random Forest** + 매 hand feature.
|
||||
- **Caliskan 2015**: 매 binary attribution.
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
#### Deep learning
|
||||
- **Binary embedding**: 매 SAFE, 매 Asm2Vec.
|
||||
- **Graph NN** on CFG.
|
||||
- **Transformer** on instruction sequence.
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
#### Contrastive
|
||||
- **PalmTree, jTrans**: 매 binary similarity.
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
### 매 응용
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
#### Forensic
|
||||
- 매 malware authorship attribution.
|
||||
- 매 APT group identification.
|
||||
- 매 ransomware family.
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
#### Open source
|
||||
- 매 plagiarism detection.
|
||||
- 매 license violation tracking.
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
#### Security research
|
||||
- 매 vulnerability fingerprint.
|
||||
- 매 N-day exploit detection.
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
#### AI-generated code detection
|
||||
- 매 GitHub Copilot / GPT 의 generated.
|
||||
- 매 AI assertion (some papers > 90%).
|
||||
- 매 watermark (statistical).
|
||||
|
||||
```text
|
||||
# TODO
|
||||
### 매 challenge
|
||||
1. **Compiler / optimization 변동**: 매 same source 의 다른 binary.
|
||||
2. **Stripped binary**: 매 symbol 의 X.
|
||||
3. **Obfuscation**: 매 anti-stylometry.
|
||||
4. **Multi-author**: 매 commit 의 mix.
|
||||
5. **Transfer**: 매 different language / 다른 platform.
|
||||
|
||||
### 매 anti-stylometry (defense)
|
||||
- **Style anonymization**: 매 normalization.
|
||||
- **Adversarial perturbation**.
|
||||
- **Code rewriter**: 매 syntactic transform.
|
||||
|
||||
### 매 ethics
|
||||
- **Whistleblower**: 매 anonymous code 의 expose 의 risk.
|
||||
- **Open source**: 매 author 의 reveal.
|
||||
- **Research participant**: 매 consent.
|
||||
- **Government**: 매 dissident code 의 attribution.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Feature extraction (CFG-based)
|
||||
```python
|
||||
import angr # 매 binary analysis
|
||||
|
||||
def extract_cfg_features(binary_path):
|
||||
proj = angr.Project(binary_path, auto_load_libs=False)
|
||||
cfg = proj.analyses.CFGFast()
|
||||
|
||||
return {
|
||||
'n_functions': len(cfg.functions),
|
||||
'avg_basic_blocks': np.mean([len(f.blocks) for f in cfg.functions.values()]),
|
||||
'avg_function_size': np.mean([f.size for f in cfg.functions.values()]),
|
||||
'cyclomatic_complexity': sum(f.cyclomatic_complexity for f in cfg.functions.values()),
|
||||
'call_depth_max': cfg.call_graph_max_depth,
|
||||
}
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Instruction n-gram
|
||||
```python
|
||||
import capstone
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
def instruction_ngrams(binary, n=3):
|
||||
md = capstone.Cs(capstone.CS_ARCH_X86, capstone.CS_MODE_64)
|
||||
instructions = []
|
||||
for insn in md.disasm(binary, 0x1000):
|
||||
instructions.append(insn.mnemonic) # 매 mov, push, call, ...
|
||||
|
||||
ngrams = collections.Counter()
|
||||
for i in range(len(instructions) - n + 1):
|
||||
ngrams[tuple(instructions[i:i+n])] += 1
|
||||
return ngrams
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Binary embedding (SAFE-style)
|
||||
```python
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
class BinaryEmbedding(nn.Module):
|
||||
"""매 instruction sequence → 매 vector."""
|
||||
def __init__(self, vocab_size=10000, dim=128):
|
||||
super().__init__()
|
||||
self.emb = nn.Embedding(vocab_size, dim)
|
||||
self.lstm = nn.LSTM(dim, dim, batch_first=True, bidirectional=True)
|
||||
self.proj = nn.Linear(dim * 2, dim)
|
||||
|
||||
def forward(self, instruction_ids):
|
||||
x = self.emb(instruction_ids)
|
||||
_, (h, _) = self.lstm(x)
|
||||
h = torch.cat([h[0], h[1]], dim=-1)
|
||||
return self.proj(h)
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
# 매 train: 매 contrastive (same author 의 close, different 의 far).
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### Author classifier (RF on features)
|
||||
```python
|
||||
from sklearn.ensemble import RandomForestClassifier
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
# 매 N author 의 binary 의 collect
|
||||
X, y = [], []
|
||||
for author, binaries in dataset.items():
|
||||
for b in binaries:
|
||||
features = extract_features(b)
|
||||
X.append(features)
|
||||
y.append(author)
|
||||
|
||||
X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y)
|
||||
|
||||
clf = RandomForestClassifier(n_estimators=500, random_state=42)
|
||||
clf.fit(X_train, y_train)
|
||||
print(clf.score(X_test, y_test))
|
||||
```
|
||||
|
||||
### AI vs Human code detection
|
||||
```python
|
||||
# 매 modern: GPTZero-style on code
|
||||
def detect_ai_code(code, perplexity_threshold=30):
|
||||
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
||||
tok = GPT2Tokenizer.from_pretrained('gpt2')
|
||||
model = GPT2LMHeadModel.from_pretrained('gpt2')
|
||||
|
||||
inputs = tok(code, return_tensors='pt')
|
||||
with torch.no_grad():
|
||||
outputs = model(**inputs, labels=inputs['input_ids'])
|
||||
|
||||
perplexity = torch.exp(outputs.loss).item()
|
||||
return perplexity < perplexity_threshold # 매 low PP = 매 AI
|
||||
```
|
||||
|
||||
→ 매 unreliable (false positive 많음).
|
||||
|
||||
### Style normalization (anti-stylometry)
|
||||
```python
|
||||
def normalize_code_style(source):
|
||||
"""매 stylometric leak 의 reduce."""
|
||||
# 매 indentation 의 standardize
|
||||
source = re.sub(r'\t', ' ', source)
|
||||
# 매 variable rename
|
||||
ast_tree = ast.parse(source)
|
||||
# 매 visit + rename — 매 deterministic.
|
||||
# 매 brace style normalize, etc.
|
||||
return source
|
||||
```
|
||||
|
||||
### Malware family clustering
|
||||
```python
|
||||
from sklearn.cluster import DBSCAN
|
||||
|
||||
def cluster_malware(binaries):
|
||||
embeddings = [embed(b) for b in binaries]
|
||||
clusterer = DBSCAN(eps=0.3, min_samples=3, metric='cosine')
|
||||
labels = clusterer.fit_predict(embeddings)
|
||||
|
||||
families = collections.defaultdict(list)
|
||||
for b, lbl in zip(binaries, labels):
|
||||
if lbl >= 0: families[lbl].append(b)
|
||||
return families
|
||||
```
|
||||
|
||||
## 🤔 결정 기준
|
||||
| 응용 | Approach |
|
||||
|---|---|
|
||||
| Malware attribution | CFG feature + RF |
|
||||
| Plagiarism (binary) | SAFE / Asm2Vec embedding |
|
||||
| AI code detection | Perplexity (unreliable) + watermark |
|
||||
| Cross-compiler | Multi-binary aggregate |
|
||||
| Stripped binary | Decompiler + style |
|
||||
| Privacy protect | Style normalization |
|
||||
|
||||
**기본값**: 매 hand-feature + RF baseline. 매 SAFE / 매 transformer 의 SOTA.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Security]] · [[Forensics]] · [[Static-Analysis-Linting]]
|
||||
- 변형: [[Code-Stylometry]] · [[Malware-Attribution]] · [[AI-Code-Detection]]
|
||||
- 응용: [[CFG-Analysis]] · [[Binary-Embedding]] · [[Reverse-Engineering]]
|
||||
- Adjacent: [[Watermarking]] · [[AI-Generated-Code-Assurance]] · [[Authenticity]] · [[Anonymous-Communication]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 malware analysis. 매 plagiarism check. 매 AI code detection (cautious). 매 forensic investigation.
|
||||
**언제 X**: 매 single binary (insufficient sample). 매 anonymous whistleblower 의 expose (ethics).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Single-feature reliance**: 매 single signal 의 spoof.
|
||||
- **Stripped binary 의 high confidence**: 매 less info.
|
||||
- **Closed-source 의 production claim**: 매 verify X.
|
||||
- **AI-detection (GPTZero-on-code)** 의 100% trust: 매 false positive.
|
||||
- **Anti-stylometry 의 ignore**: 매 author 의 active resist.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Caliskan-Islam 2015 USENIX, SAFE 2019, Asm2Vec).
|
||||
- 신뢰도 B (active research).
|
||||
- Related: [[AI-Generated-Code-Assurance]] · [[Authenticity]] · [[Static-Analysis-Linting]] · [[Watermarking]].
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — feature + ML approach + 매 angr / capstone / RF / SAFE code + AI detection |
|
||||
|
||||
Reference in New Issue
Block a user