File size: 7,286 Bytes
5f527b0
 
 
fa234a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f527b0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
---
license: apache-2.0
---
# summerMC/Qwen3.5-hack-down

`summerMC/Qwen3.5-hack-down` は、認可されたローカル CTF / セキュリティ演習環境での解析支援を目的としたモデルです。

実運用システム、第三者環境、許可のない対象への攻撃支援を目的とした利用は想定していません。

## 概要

このモデルは、CTF 問題、ローカルラボ、検証用の脆弱性解析、ログ解析、コードレビュー、ペイロードの理解補助などを支援するためのアシスタントモデルです。

主な用途は次のとおりです。

- CTF 問題文の整理
- Web / Crypto / Reversing / Forensics / Pwn / Misc などの方針整理
- ローカル検証環境における安全な解析支援
- コード断片やエラー内容の説明
- フラグ探索手順の構造化
- JSON 形式での簡潔な回答生成

## 想定ユースケース

適切な利用例:

- 自分で用意した Docker / VM / ローカルラボの解析
- CTF プラットフォーム上の許可された問題の解法補助
- 学習目的の脆弱性検証
- 防御・監査目的のコード確認
- 問題文、ログ、ソースコード、バイナリ解析結果の要約

不適切な利用例:

- 許可のないシステムへの侵入
- 実在サービスへの攻撃手順の自動化
- 認証回避、情報窃取、マルウェア作成の支援
- 第三者環境でのスキャン、悪用、権限昇格
- 取得していないフラグや証跡の捏造

## 推奨システムプロンプト

```text
You are a CTF assistant for authorized local lab challenges only.
Return structured, practical, concise JSON.
Do not invent flags.
```

## 出力方針

モデルには、以下のような出力形式を推奨します。

```json
{
  "summary": "問題の要約",
  "category": "web / crypto / pwn / reversing / forensics / misc / unknown",
  "observations": [
    "確認できた事実"
  ],
  "next_steps": [
    "次に試すべき安全な手順"
  ],
  "commands": [
    {
      "purpose": "ローカル検証で使う目的",
      "command": "example command"
    }
  ],
  "flag": null,
  "confidence": "low / medium / high"
}
```

`flag` は、ユーザーが明示的に提供した場合、またはローカル解析結果から確実に導出できた場合のみ記載してください。推測でフラグを生成しないでください。

## Python での使用例

```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "summerMC/Qwen3.5-hack-down"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True,
)

messages = [
    {
        "role": "system",
        "content": (
            "You are a CTF assistant for authorized local lab challenges only. "
            "Return structured, practical, concise JSON. Do not invent flags."
        ),
    },
    {
        "role": "user",
        "content": "このCTF問題の方針を整理してください: ...",
    },
]

prompt = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=700,
        do_sample=True,
        temperature=0.3,
        top_p=0.85,
        repetition_penalty=1.08,
        pad_token_id=tokenizer.pad_token_id,
        eos_token_id=tokenizer.eos_token_id,
    )

generated = outputs[0][inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(generated, skip_special_tokens=True))
```

## ストリーミング生成

```python
from threading import Thread
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStreamer

model_id = "summerMC/Qwen3.5-hack-down"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True,
)

def generate_stream(user_prompt, max_new_tokens=700):
    messages = [
        {
            "role": "system",
            "content": (
                "You are a CTF assistant for authorized local lab challenges only. "
                "Return structured, practical, concise JSON. Do not invent flags."
            ),
        },
        {
            "role": "user",
            "content": user_prompt,
        },
    ]

    prompt = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=True,
    )

    inputs = tokenizer(
        prompt,
        return_tensors="pt",
        truncation=True,
        max_length=2048,
    ).to(model.device)

    streamer = TextIteratorStreamer(
        tokenizer,
        skip_prompt=True,
        skip_special_tokens=True,
    )

    generation_kwargs = dict(
        **inputs,
        streamer=streamer,
        max_new_tokens=max_new_tokens,
        do_sample=True,
        temperature=0.3,
        top_p=0.85,
        repetition_penalty=1.08,
        pad_token_id=tokenizer.pad_token_id,
        eos_token_id=tokenizer.eos_token_id,
    )

    thread = Thread(target=model.generate, kwargs=generation_kwargs)
    thread.start()

    for chunk in streamer:
        yield chunk

    thread.join()


for chunk in generate_stream("このCTF問題を解析してください: ..."):
    print(chunk, end="", flush=True)
```

## 推奨パラメータ

| Parameter | Value |
|---|---:|
| `max_new_tokens` | `700` |
| `temperature` | `0.3` |
| `top_p` | `0.85` |
| `repetition_penalty` | `1.08` |
| `do_sample` | `True` |

CTF の方針整理では、低めの `temperature` を推奨します。出力の多様性よりも、再現性と簡潔さを優先します。

## 制限事項

- このモデルはフラグを自動的に保証するものではありません。
- 実測ベンチマーク、学習データ、学習手法の詳細はこの README では未公開です。
- 出力には誤りが含まれる可能性があります。
- セキュリティ関連の助言は、必ず認可された環境でのみ検証してください。
- 実在サービスや第三者環境への攻撃には使用しないでください。

## 評価

現時点で公開できる定量評価はありません。

| Benchmark | Score |
|---|---:|
| CTF benchmark | 未測定 |
| Web security tasks | 未測定 |
| Reversing tasks | 未測定 |
| Forensics tasks | 未測定 |

## ライセンス

ライセンス情報は、モデルリポジトリ側の設定を確認してください。

この README ではライセンスを断定しません。Hugging Face の `license` メタデータまたはリポジトリ内の `LICENSE` ファイルを優先してください。

## 免責事項

このモデルの出力は学習・検証目的の補助情報です。出力内容の正確性、安全性、適法性は利用者が確認してください。

本モデルは、認可された CTF、ローカルラボ、防御的検証、教育目的での利用を前提としています。