mermaid-to-proverif
Skill này làm gì
Skill này chuyển một sơ đồ tuần tự Mermaid của giao thức mật mã thành một file mô hình ProVerif. Skill dành cho kỹ sư bảo mật muốn kiểm tra thiết kế giao thức bằng xác minh hình thức.
Khi nào nên dùng
- ✓Khi bạn có một sơ đồ Mermaid của giao thức mật mã và muốn xác minh nó một cách hình thức.
- ✓Khi bạn cần kiểm tra các thuộc tính như tính bí mật, xác thực hoặc forward secrecy.
- ✓Khi bạn muốn kiểm tra thiết kế giao thức xem có bị tấn công phát lại (replay) không.
Liên kết skill
https://github.com/trailofbits/skills/blob/main/plugins/trailmark/skills/mermaid-to-proverif/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Chuyển sơ đồ giao thức này thành mô hình ProVerif để tôi kiểm tra các khóa có được giữ bí mật không.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill đọc các thông điệp và bước mật mã của sơ đồ, rồi viết một file mô hình .pv mà công cụ ProVerif có thể kiểm tra. Skill cũng thêm các kiểm tra khả năng tiếp cận như một bài kiểm tra tỉnh táo.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Mermaid to ProVerif
Reads a Mermaid sequenceDiagram describing a cryptographic protocol and
produces a ProVerif model (.pv file) that can be passed directly to the
ProVerif verifier.
Tools used: Read, Write, Grep, Glob.
The typical input is the output of the crypto-protocol-diagram skill — a
Mermaid sequenceDiagram annotated with cryptographic operations (Sign,
Verify, DH, HKDF, Enc, Dec, etc.) and message arrows.
When to Use
- User asks to formally verify a cryptographic protocol described as a Mermaid sequenceDiagram
- User wants to generate a ProVerif model (.pv file) from a protocol diagram
- User wants to prove secrecy, authentication, or forward secrecy properties
- Input is the output of the
crypto-protocol-diagramskill
When NOT to Use
- No Mermaid sequenceDiagram exists yet — use
crypto-protocol-diagramfirst to generate one - User wants to verify properties of non-cryptographic systems (state machines, access control)
- User wants to run ProVerif on an existing .pv file — just run
proverif model.pvdirectly
Rationalizations to Reject
| Rationalization | Why It's Wrong | Required Action |
|---|---|---|
| "Reachability queries are just busywork" | If events aren't reachable, all other query results are meaningless | Always add reachability queries first as a sanity check |
| "Public channels are fine for all messages" | Private channels for internal state prevent false attacks | Use private channels for intra-process state threading |
| "I'll skip the forward secrecy test" | Ephemeral keys demand forward secrecy verification | Add the ForwardSecrecyTest process whenever the diagram shows ephemeral keys |
| "Unused declarations are harmless" | ProVerif may report spurious results from orphan declarations | Clean up all unused types, functions, and events |
| "The model compiles, so it's correct" | A compiling model can have dead receives, type mismatches, or impossible guards that make queries vacuously true | Validate reachability before trusting any security query |
| "I don't need to check the example first" | The example defines the expected output quality bar | Study examples/simple-handshake/ before working on unfamiliar protocols |
Workflow
ProVerif Model Progress:
- [ ] Step 1: Parse participants and channels
- [ ] Step 2: Inventory cryptographic operations
- [ ] Step 3: Declare types, functions, and equations
- [ ] Step 4: Identify and declare events
- [ ] Step 5: Formulate security queries
- [ ] Step 6: Write participant processes
- [ ] Step 7: Write main process and finalize
- [ ] Step 8: Verify and deliver
Step 1: Parse Participants and Channels
From the Mermaid diagram:
- Extract every
participantoractordeclaration. Each becomes a ProVerif process. - Count message arrows (
->>,-->>,-x,--x). Each distinctA ->> B: labelcreates a communication step on a channel. - Decide channel model:
- Public channel for any message sent over the network before a secure channel is established (e.g., ClientHello, ephemeral keys, ciphertext to be decrypted by the peer).
- Private channel only for internal state threading within a single party process (not for cross-party messages).
- Default: declare one shared public channel
cfor all cross-party messages. Add per-flow channels only when two distinct parallel sessions must be independent.
free c: channel.
Step 2: Inventory Cryptographic Operations
Walk through every Note over annotation and message label. Build a list of
all distinct operations used. Map each to a ProVerif declaration category:
| Mermaid annotation | ProVerif category |
|---|---|
keygen() → sk, pk |
New name (new sk), public key derived via function |
DH(sk_A, pk_B) |
DH function or exp with group |
Sign(sk, msg) → σ |
Signature function |
Verify(pk, msg, σ) |
Equation or destructor |
Enc(key, msg) → ct |
Symmetric or asymmetric encryption function |
Dec(key, ct) → msg |
Destructor (equation) |
HKDF(ikm, info) → k |
PRF/KDF function |
HMAC(key, msg) → tag |
MAC function |
H(msg) → digest |
Hash function |
Commit(v, r) → C |
Commitment function |
Open(C, v, r) |
Commitment equation |
Consult references/crypto-to-proverif-mapping.md for exact ProVerif syntax for e
Câu hỏi thường gặp
Tôi có cần skill vẽ sơ đồ giao thức trước không?
Thường là có. Skill vẽ sơ đồ giao thức mật mã tạo ra sơ đồ Mermaid mà skill này đọc.
Skill có tự chạy ProVerif cho tôi không?
Không. Nó chỉ viết file mô hình, và bạn tự chạy nó bằng ProVerif.
Nó có thể kiểm tra những thuộc tính nào?
Nó được thiết lập cho tính bí mật, xác thực và forward secrecy, cùng các kiểm tra tấn công phát lại.
Chi tiết
Mô tả gốc của tác giả
Translates Mermaid sequenceDiagrams describing cryptographic protocols into ProVerif formal verification models (.pv files). Use when generating a ProVerif model, formally verifying a protocol, converting a Mermaid diagram to ProVerif, verifying protocol security properties (secrecy, authentication, forward secrecy), checking for replay attacks, or producing a .pv file from a sequence diagram.
repo: trailofbits/skills
Độ phổ biến
- Sao GitHub
- 8.0k
- Vị trí xếp hạng
- #12730
- Giấy phép
- CC-BY-SA-4.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
audit-context-building
8.0kGiúp agent tìm hiểu một codebase lạ trước khi review bảo mật, lập bản đồ những gì mỗi hàm giả định, đảm bảo và phụ thuộc vào.
algorand-vulnerability-scanner
8.0kGiúp agent quét smart contract Algorand viết bằng TEAL hoặc PyTeal để tìm 11 vấn đề bảo mật phổ biến, như tấn công rekey và phí không được kiểm tra.
audit-prep-assistant
8.0kGiúp agent chuẩn bị codebase cho một đợt review bảo mật bên ngoài, với phân tích tĩnh, độ phủ test, dọn mã chết và tài liệu rõ ràng.
cairo-vulnerability-scanner
8.0kGiúp agent quét smart contract Cairo trên StarkNet để tìm 6 vấn đề nghiêm trọng, gồm tràn số học, thông điệp xuyên lớp rủi ro và replay chữ ký.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.