api-and-interface-desi…
Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints,…
Reverse engineer and security-test Telegram bots — API analysis, callback interception, exploit discovery, and vulnerability documentation
$ npx -y skills add kevinnft/ai-agent-skills --skill telegram-bot-security-analysis --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/telegram-bot-security-analysisContext preview
The summary Claude sees to decide when to auto-load this skill.
Reverse engineer and security-test Telegram bots — API analysis, callback interception, exploit discovery, and vulnerability documentation
name: telegram-bot-security-analysis description: Reverse engineer and security-test Telegram bots — API analysis, callback interception, exploit discovery, and vulnerability documentation tags: [telegram, security, reverse-engineering, bot-api, exploit-analysis] origin: unknown source_license: see upstream language: en
Comprehensive methodology for analyzing Telegram bots to discover security vulnerabilities, reverse engineer backend systems, and document exploits.
**Login and Access:**
from telethon import TelegramClient
API_ID = 94575 # Public Telegram API credentials
API_HASH = 'a3406de8d171bb422bb6ddf3bbd800e2'
client = TelegramClient('session_name', API_ID, API_HASH)
await client.start()**Bot Information Gathering:**
**Command Discovery:**
commands = [
'/help', '/menu', '/balance', '/wallet', '/deposit',
'/withdraw', '/profile', '/settings', '/admin', '/debug'
]
for cmd in commands:
await client.send_message(bot, cmd)
await asyncio.sleep(1)**Conversation Dump:**
all_msgs = await client.get_messages(bot, limit=200)
conversation = []
for msg in reversed(all_msgs):
if msg.text:
sender = "BOT" if msg.from_id == bot.id else "USER"
conversation.append({
"sender": sender,
"time": msg.date.strftime('%Y-%m-%d %H:%M:%S'),
"text": msg.text,
"buttons": [[btn.text for btn in row] for row in msg.buttons] if msg.buttons else None
})**Intercept Callback Data:**
from telethon.tl.functions.messages import GetBotCallbackAnswerRequest
# Get button callback data
for button in msg.reply_markup.rows:
if hasattr(button, 'data'):
callback_data = button.data.decode('utf-8', errors='ignore')
print(f"Callback: {callback_data}")**Extract Web App URLs:**
# Check for magic links, payment URLs, admin panels
for button in msg.buttons:
if hasattr(button, 'button') and hasattr(button.button, 'url'):
url = button.button.url
if 'magic' in url or 'admin' in url or 'api' in url:
print(f"Suspicious URL: {url}")**Common Patterns:**
**Server Fingerprinting:**
curl -I http://target-ip:port/ # Look for: Server header, framework version, error messages
**Endpoint Fuzzing:**
# Common API paths /api /api/v1 /api/wallet /api/balance /api/deposit /admin /debug /magic /webhook /callback
**Common Vulnerability Classes:**
1. **Premature Reward Distribution**
2. **2FA/Authentication Bypass**
3. **Race Conditions**
4. **Payment Approval Manipulation**
5. **Referral/Reward Gaming**
**Structure:**
## Vulnerability Summary - Type: [Premature Reward / Auth Bypass / Race Condition] - Severity: [Low / Medium / High / Critical] - Impact: [Financial loss / Data breach / Account takeover] ## Exploit Steps 1. Step-by-step reproduction 2. Required prerequisites 3. Expected outcome ## Technical Details - Root cause analysis - Code snippets (if available) - Attack flow diagram ## Mitigation - Recommended fixes - Code patches - Security best practices
**Message Inspection:**
# Get conversation history
msgs = await client.get_messages(bot, limit=100)
# Filter for specific content
for msg in msgs:
if msg.buttons:
# Analyze button structure
if msg.text and 'reward' in msg.text.lower():
# Flag reward-related messages**Callback Testing:**
# Test crafted callback data
test_payloads = [
b'admin', b'debug', b'wallet', b'claim',
b'{"action":"deposit","amount":9999}',
]
for payload in test_payloads:
try:
result = await client(GetBotCallbackAnswerRequest(
peer=bot, msg_id=msg.id, data=payload
))
if result.message:
print(f"Payload {payload} → {result.message}")
except Exception as e:
print(f"Payload {payload} → Error: {e}")For testing backend APIs discovered during bot analysis:
**Test cases:**
TEST_CASES = [
# Negative values
{"amount": -1, "price": 10},
# Zero values
{"amount": 0, "price": 10},
# Float where integer expected
{"amount": 0.1, "price": 10},
# Very large numbers (integer overflow)
{"amount": 2**63, "price": 10},
# SQL injection
{"amount": "1 OR 1=1", "price": 10},
{"amount": "1'; DROP TABLE users--", "price": 10},
# XSS injection
{"amount": "<script>alert(1)</script>", "price": 10},
# Null/undefined
{"amount": None, "price": 10},
# Type confusion
{"amount": "1", "price": "10"}, # String instead of number
{"amount": [1], "price": 10}, # Array instead of number
]import concurrent.futures
def send_request():
return requests.post(
"https://target.com/api/endpoint",
headers=headers,
json={"amount": 1, "price": 1191 attribution-first agent skills for Hermes Agent, Claude Code, Cursor — one installer, 28 categories, searchable catalog. See NOTICE for upstream attribution.
Repo: kevinnft/ai-agent-skills
Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints,…
Tests in real browsers. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze…
Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test…
Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to…
Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend…
Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure…