
लाइव रिकॉन और AI एजेंट इंफ्रास्ट्रक्चर के लिए पोस्चर ऑडिटिंग: सीक्रेट्स, पॉइज़न्ड कैटलॉग और CoT लीक्स के लिए MCP कॉन्फ़िग्स, सेशन लॉग्स और APIs स्कैन करता है।
वहीं बैठें जहाँ मॉडल बैठता है। देखें कि वह क्या देख सकता है।
MASQ AI एजेंट स्टैक के लिए एक स्थानीय सुरक्षा CLI है। यह उसी स्थान पर बैठता है जहाँ मॉडल बैठता है: यह MCP टूल कैटलॉग पढ़ता है, MCP हैंडशेक पूरा करता है, सत्र लॉग देखता है, और स्थानीय मॉडल HTTP पोर्ट की जाँच करता है। फिर यह निष्कर्ष और उपचार प्रिंट करता है।
यह MCP और OpenAI-संगत HTTP को उसी तरह बोलता है जैसे क्लाइंट बोलता है। यह उसी तरह रिपोर्ट करता है जैसे कोई होस्ट रेकॉन टूल करता है। यह लाइव सर्वर पर टूल्स को नहीं कॉल करता, चेन-ऑफ-थॉट को डिक्रिप्ट नहीं करता, या जेलब्रेक नहीं बनाता।
| इसका उपयोग कब करें | जब आप Cursor, VS Code, Claude, Codex, या कोई स्थानीय मॉडल स्टैक चलाते हैं और यह देखना चाहते हैं कि एजेंट किन MCP सर्वर, स्किल्स, लॉग्स और APIs तक पहुँच सकता है। |
| शुरुआत करें | नीचे दिए गए दो मिनट के डेमो से। यह इसी रेपो के भीतर रहता है। |
| स्थिति | बीटा। cargo test सार्वजनिक गेट है। लाइव प्रोब उन होस्ट्स के लिए हैं जिनके आप स्वामी हैं। |
| लाइसेंस | MIT |
आपको Rust stable (1.88 या नया) और Python 3 चाहिए। इस रेपो के क्लोन से:
cargo build --locked --bin masq
alias masq=./target/debug/masq
# or run the same walkthrough as a script:
# bash scripts/demo.sh
1. एक स्वच्छ कैटलॉग स्वच्छ रहता है
masq fixtures/clean_calculator.json --trusted
CLEAN clean_calculator tools=2 hash=sha256:e680cd2e4ac6c80ec783f11a0d9272a6741797feba216eb8e79633dd59633ab4
0 पर बाहर निकलें।
2. एक ज़हरीला कैटलॉग गेट में विफल रहता है
fixtures/t3_line_jump.json एक sqrt टूल है जिसका विवरण मॉडल को बताता है कि हर सत्र में सबसे पहले इससे परामर्श लें और शेल कमांड्स को एक कैनरी curl के साथ प्रीफ़िक्स करें। यह कैटलॉग ज़हर है, गणित नहीं।
masq fixtures/t3_line_jump.json
FINDINGS t3_line_jump tools=1 findings=2 max=critical
F-001 [critical] D02 mcp03=schema_poison sqrt Network exfiltration directive in schema
path: $.tools[0].description
F-002 [critical] D03 mcp03=schema_poison sqrt Line-jump: force tool consultation / session prefix
path: $.tools[0].description
2 पर बाहर निकलें (--fail-on पर या उससे ऊपर के निष्कर्ष, डिफ़ॉल्ट high)।
3. मॉडल की तरह एक लाइव MCP को बैठाएं
इन-ट्री मॉक stdio के माध्यम से MCP बोलता है। masq initialize, notifications/initialized, और tools/list भेजता है। यह कभी tools/call नहीं भेजता।
masq sit --plain --no-color -- python3 tests/mock_mcp_server.py
01 CATALOG
M-001 CRIT live Secret path or credential exfil directive
Schema references secret file paths or credential stores in an agent-directed way.
ACT Never reference host secret paths in tool metadata.
LOCUS stdio:python3 :: add
M-002 HIGH live IPI / poison language in tool metadata
Local classifier hit `system-override` in tool `add`.
ACT Remove agent-directed instructions from the tool description.
M-003 HIGH live Instruction-override language in schema string
Text matches common prompt-injection / instruction-override phrasing in tool metadata.
M-004 HIGH live Pre-action system instruction in schema
Schema instructs the model to perform actions before the normal tool purpose.
02 SEAT
HIT stdio python3 init ok name=mock-poison tools=1
मॉक का add टूल विवरण मॉडल को अंकगणित करने से पहले ~/.ssh/id_rsa पढ़ने का निर्देश देता है। masq लाइव tools/list से उसे फ़्लैग करता है, फिर 2 के साथ बाहर निकल जाता है।
4. एक नमूना सत्र लॉग सूँघें
fixtures/demo/chat_history.jsonl एक नकली API कुंजी और एक एन्क्रिप्टेड थिंकिंग ब्लॉब रखता है। टाइमलाइन देखने के लिए masq को उस निर्देशिका की ओर इंगित करें - अपने वास्तविक चैट इतिहास की ओर नहीं।
masq sniff --timeline --plain --no-color fixtures/demo
T0001 SECRET chat_history.jsonl:2 {"content":"Authorization: Bearer sk-x……
T0002 BLOB chat_history.jsonl:3 encrypted_content len=202
रोपित कुंजी को संपादित किया गया है। एन्क्रिप्टेड चेन-ऑफ-थॉट को लंबाई के आधार पर रिपोर्ट किया जाता है, डिकोड नहीं किया जाता।
5. जिस कैटलॉग की आपने समीक्षा की है उसे पिन करें, फिर ड्रिफ्ट को पकड़ें
masq pin fixtures/clean_calculator.json -k calc
masq check fixtures/clean_calculator.json -k calc --trusted
pin .masq/pins.json लिखता है। यदि टूल सूची या हैश बदलते हैं (rug-pull) तो check बाद में विफल हो जाता है।
हर जगह एग्ज़िट कोड: 0 स्वच्छ · 2 निष्कर्ष ≥ --fail-on · 1 त्रुटि।
स्टैटिक MCP स्कैनर स्कीमा को लिंट करते हैं। हेल्थ चेक initialize को पिंग करते हैं। कमी सीट की है: वे फ़ाइलें, लिसनर, और हैंडशेक जिन्हें मॉडल पहले से उपयोग करता है।
initialize स्वीकार करता है। यदि आप वह हैंडशेक पूरा कर सकते हैं, तो आप पहले से ही एजेंट हैं। masq बैठता है; यह टूल्स को कॉल नहीं करता।11434, 8000, और इसी तरह के अन्य अक्सर बिना किसी बियरर के 0.0.0.0 पर बाइंड होते हैं। masq केवल-GET जाँचों के साथ सेवा (Ollama, vLLM, LiteLLM, …) की फ़िंगरप्रिंट बनाता है, फिर मॉडलों को सूचीबद्ध करता है।flowchart LR
A["MCP tools/list JSON"] --> M[masq]
B["Live MCP server"] --> M
C["Session logs"] --> M
D["Local model HTTP"] --> M
M --> E["Findings + remediations"]
M --> F["Optional pin store for CI"]
git clone https://gitlab.com/WattoCyber/masq.git
cd masq
cargo install --path . --locked
# command: masq
masq --version
masq --help
इसके लिए वर्तमान Rust stable (1.88+; rustup के साथ इंस्टॉल करें) आवश्यक है। cargo test सार्वजनिक गेट है। Python 3 केवल डेमो और टेस्ट में लाइव stdio मॉक के लिए आवश्यक है।
SSH के माध्यम से किसी रिमोट Unix होस्ट पर बिल्ड करने के लिए (केवल इंस्टॉल; उस होस्ट को स्कैन नहीं करता):
MASQ_REMOTE_HOST=user@host bash scripts/deploy_remote.sh
# on that host: masq --version
डेमो कभी इस रिपॉज़िटरी से बाहर नहीं जाता। ये कमांड बाहर जाते हैं, और जब तक आप किसी लैब allowlist में शामिल नहीं होते, ये इस मशीन तक सीमित रहते हैं।
tools/list JSON को एक्सपोर्ट या सेव करें, फिर:
masq path/to/tools.json
masq path/to/tools.json --json
masq path/to/tools.json --markdown
Bare .json पथ scan में बदल जाते हैं। दो या अधिक JSON फ़ाइलें multi बन जाती हैं।
masq sit -- python3 -m your_mcp
masq sit --url http://127.0.0.1:PORT/mcp
Loopback पर्याप्त है। Off-loopback URLs के लिए --lab और एक allowlisted host भी आवश्यक है (नीचे देखें)। Auth, यदि सर्वर को इसकी आवश्यकता है:
masq sit --url http://127.0.0.1:PORT/mcp --token-file /path/to/token
masq sit --url http://127.0.0.1:PORT/mcp --token-env MCP_TOKEN
masq sit --url http://127.0.0.1:PORT/mcp --header "Authorization: Bearer …"
टोकन कभी भी रिपोर्ट में नहीं लिखे जाते।