Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Extract embedded configuration from Agent Tesla RAT samples including SMTP/FTP/Telegram exfiltration credentials, keylogger settings, and C2 endpoints using .NET decompilation and memory analysis.
.claude/skills/extracting-config-from-agent-tesla-rat/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | — | — |
| case-02 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✗ | = Same ✗ | — | — |
| case-15 | ✗→✗ | = Same ✗ | — | — |
| case-22 | ✗→✗ | = Same ✗ | — | — |
Agent Tesla is a .NET-based Remote Access Trojan (RAT) and keylogger that ranked among the top 10 malware variants in 2024, impacting 6.3% of corporate networks globally. It exfiltrates stolen credentials via SMTP email, FTP upload, Telegram bot API, or Discord webhooks. The malware configuration is embedded in the .NET assembly, typically obfuscated using string encryption, resource encryption, or custom loaders that decrypt and execute Agent Tesla in memory via .NET Reflection (fileless). Configuration extraction involves decompiling the .NET assembly with dnSpy or ILSpy, identifying the decryption routine for configuration strings, and extracting SMTP server addresses, credentials, FTP endpoints, Telegram bot tokens, and targeted applications.
dnlib or pythonnet for automated extractionpython#!/usr/bin/env python3 """Extract Agent Tesla RAT configuration from .NET assemblies.""" import re import sys import json import base64 import hashlib from pathlib import Path def extract_strings_from_dotnet(filepath): """Extract readable strings from .NET binary for config analysis.""" with open(filepath, 'rb') as f: data = f.read() # Extract US (User Strings) heap from .NET metadata strings = [] # Look for common Agent Tesla config patterns patterns = { "smtp_server": re.compile(rb'smtp[\.\-][\w\.\-]+\.\w{2,}', re.I), "email": re.compile(rb'[\w\.\-]+@[\w\.\-]+\.\w{2,}'), "ftp_url": re.compile(rb'ftp://[\w\.\-:/]+', re.I), "telegram_token": re.compile(rb'\d{8,10}:[A-Za-z0-9_-]{35}'), "telegram_chat": re.compile(rb'(?:chat_id=|chatid[=:])[\-]?\d{5,15}', re.I), "discord_webhook": re.compile(rb'https://discord\.com/api/webhooks/\d+/[\w-]+'), "password": re.compile(rb'(?:pass(?:word)?|pwd)[=:]\s*[\w!@#$%^&*]{4,}', re.I), "port": re.compile(rb'(?:port|smtp_port)[=:]\s*\d{2,5}', re.I), } results = {} for name, pattern in patterns.items(): matches = pattern.findall(data) if matches: results[name] = [m.decode('utf-8', errors='replace') for m in matches] # Extract Base64-encoded strings (common obfuscation) b64_pattern = re.compile(rb'[A-Za-z0-9+/]{20,}={0,2}') b64_decoded = [] for match in b64_pattern.finditer(data): try: decoded = base64.b64decode(match.group()) text = decoded.decode('utf-8', errors='strict') if text.isprintable() and len(text) > 5: b64_decoded.append(text) except Exception: pass if b64_decoded: results["base64_decoded_strings"] = b64_decoded[:30] return results def decrypt_agenttesla_strings(data, key_hex): """Decrypt Agent Tesla encrypted configuration strings.""" key = bytes.fromhex(key_hex) # Agent Tesla V1: Simple XOR with key decrypted_strings = [] # Find encrypted blobs (high-entropy byte sequences) blob_pattern = re.compile(rb'[\x80-\xff]{16,256}') for match in blob_pattern.finditer(data): blob = match.group() # Try XOR decryption decrypted = bytes(b ^ key[i % len(key)] for i, b in enumerate(blob)) try: text = decrypted.decode('utf-8', errors='strict') if text.isprintable() and len(text.strip()) > 3: decrypted_strings.append(text.strip()) except UnicodeDecodeError: pass # V2: SHA256-based key derivation then AES sha256_key = hashlib.sha256(key).digest() return decrypted_strings def analyze_exfiltration_config(config): """Analyze extracted configuration for exfiltration methods.""" methods = [] if config.get("smtp_server"): methods.append({ "type": "SMTP", "servers": config["smtp_server"], "emails": config.get("email", []), }) if config.get("ftp_url"): methods.append({ "type": "FTP", "urls": config["ftp_url"], }) if config.get("telegram_token"): methods.append({ "type": "Telegram", "tokens": config["telegram_token"], "chat_ids": config.get("telegram_chat", []), }) if config.get("discord_webhook"): methods.append({ "type": "Discord", "webhooks": config["discord_webhook"], }) return methods if __name__ == "__main__": if len(sys.argv) < 2: print(f"Usage: {sys.argv[0]} <agent_tesla_sample>") sys.exit(1) config = extract_strings_from_dotnet(sys.argv[1]) methods = analyze_exfiltration_config(config) report = {"raw_config": config, "exfiltration_methods": methods} print(json.dumps(report, indent=2))
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 23 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.