data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTrigger Intents
触发场景
Use this skill when user asks to:
- search strings/bytes/patterns quickly
- map string evidence to code usage
- investigate raw data-level indicators (IOCs, constants, signatures)
Route to:
- for relationship expansion from matched addresses
xrefs - for triage synthesis from data signals
analysis - when findings should drive patch/breakpoint actions
debugger
当用户提出以下需求时使用本技能:
- 快速搜索字符串/字节/模式
- 将字符串线索映射到代码使用场景
- 调查原始数据级别的指示器(IOC、常量、签名)
流转至:
- :从匹配地址扩展关系分析
xrefs - :基于数据信号进行分类综合分析
analysis - :根据分析结果执行补丁/断点操作
debugger
Do This First (Warm-Start Sequence)
先执行以下步骤(预热流程)
sql
-- 1) Validate string availability
SELECT COUNT(*) AS strings FROM strings;
-- 2) Sample high-value strings
SELECT content, printf('0x%X', address) AS addr
FROM strings
WHERE length >= 8
ORDER BY length DESC
LIMIT 40;
-- 3) If expected strings are missing, rebuild once
SELECT rebuild_strings();Interpretation guidance:
- Strings are often quickest behavioral clues; pivot to immediately for execution context.
xrefs - For opcode/pattern hunts, prefer the table over full instruction scans.
byte_search
sql
-- 1) 验证字符串可用性
SELECT COUNT(*) AS strings FROM strings;
-- 2) 采样高价值字符串
SELECT content, printf('0x%X', address) AS addr
FROM strings
WHERE length >= 8
ORDER BY length DESC
LIMIT 40;
-- 3) 若预期字符串缺失,重建一次字符串表
SELECT rebuild_strings();解读指引:
- 字符串通常是最快捷的行为线索,应立即转向获取执行上下文。
xrefs - 对于操作码/模式搜索,优先使用表而非全指令扫描。
byte_search
Failure and Recovery
故障排查与恢复
- No strings or unexpectedly low count:
- Run and validate with
rebuild_strings().COUNT(*) FROM strings
- Run
- Too many false positives:
- Increase specificity (, regex-like pattern narrowing, module/function join filters).
LIKE
- Increase specificity (
- Byte pattern search too broad:
- Restrict by range or join matched byte addresses to .
funcs
- Restrict by range or join matched byte addresses to
- Need named functions, labels, structs, or members instead of string contents:
- Use , not
greporstrings.byte_search
- Use
- 无字符串或数量异常偏低:
- 执行,并通过
rebuild_strings()验证结果。COUNT(*) FROM strings
- 执行
- 误报过多:
- 提高查询特异性(使用、类正则模式缩小范围、模块/函数关联过滤)。
LIKE
- 提高查询特异性(使用
- 字节模式搜索范围过广:
- 通过地址范围限制,或将匹配的字节地址与表关联。
funcs
- 通过地址范围限制,或将匹配的字节地址与
- 需要查找命名函数、标签、结构体或成员而非字符串内容:
- 使用,而非
grep或strings。byte_search
- 使用
Handoff Patterns
流转模式
- ->
datato convert data hits into code paths/functions.xrefs - ->
datafor risk scoring and campaign-level insight.analysis - ->
datafor actionable patch/watchpoint setup.debugger
- ->
data:将数据命中结果转换为代码路径/函数。xrefs - ->
data:进行风险评分和战役级洞察分析。analysis - ->
data:设置可执行的补丁/监视点。debugger
strings
strings
String literals found in the binary. IDA maintains a cached string list that can be configured.
| Column | Type | Description |
|---|---|---|
| INT | String address |
| INT | String length |
| INT | String type (raw encoding bits) |
| TEXT | Type name: ascii, utf16, utf32 |
| INT | Char width (0=1-byte, 1=2-byte, 2=4-byte) |
| TEXT | Width name: 1-byte, 2-byte, 4-byte |
| INT | String layout (0=null-terminated, 1-3=pascal) |
| TEXT | Layout name: termchr, pascal1, pascal2, pascal4 |
| INT | Encoding index (0=default) |
| TEXT | String content (the actual text — not |
String Type Encoding:
IDA stores string type as a 32-bit value:
- Bits 0-1: Width (0=1B/ASCII, 1=2B/UTF-16, 2=4B/UTF-32)
- Bits 2-7: Layout (0=TERMCHR, 1=PASCAL1, 2=PASCAL2, 3=PASCAL4)
- Bits 8-15: term1 (first termination character)
- Bits 16-23: term2 (second termination character)
- Bits 24-31: encoding index
sql
-- Find error messages
SELECT content, printf('0x%X', address) as addr FROM strings WHERE content LIKE '%error%';
-- ASCII strings only
SELECT * FROM strings WHERE type_name = 'ascii';
-- UTF-16 strings (common in Windows)
SELECT * FROM strings WHERE type_name = 'utf16';
-- Count strings by type
SELECT type_name, layout_name, COUNT(*) as count
FROM strings GROUP BY type_name, layout_name ORDER BY count DESC;Important: For new analysis (exe/dll), strings are auto-built. For existing databases (i64/idb), strings are already saved. If you see 0 strings unexpectedly, run once to rebuild the list. See String List Surfaces section below.
SELECT rebuild_strings()二进制文件中的字符串字面量。IDA会维护一个可配置的缓存字符串列表。
| 列名 | 类型 | 描述 |
|---|---|---|
| INT | 字符串地址 |
| INT | 字符串长度 |
| INT | 字符串类型(原始编码位) |
| TEXT | 类型名称:ascii, utf16, utf32 |
| INT | 字符宽度(0=1字节, 1=2字节, 2=4字节) |
| TEXT | 宽度名称:1-byte, 2-byte, 4-byte |
| INT | 字符串布局(0=空终止, 1-3=pascal格式) |
| TEXT | 布局名称:termchr, pascal1, pascal2, pascal4 |
| INT | 编码索引(0=默认) |
| TEXT | 字符串内容(实际文本 — 不是 |
字符串类型编码:
IDA将字符串类型存储为32位值:
- 位0-1:宽度(0=1字节/ASCII, 1=2字节/UTF-16, 2=4字节/UTF-32)
- 位2-7:布局(0=TERMCHR, 1=PASCAL1, 2=PASCAL2, 3=PASCAL4)
- 位8-15:term1(第一个终止字符)
- 位16-23:term2(第二个终止字符)
- 位24-31:编码索引
sql
-- 查找错误信息
SELECT content, printf('0x%X', address) as addr FROM strings WHERE content LIKE '%error%';
-- 仅查找ASCII字符串
SELECT * FROM strings WHERE type_name = 'ascii';
-- UTF-16字符串(Windows系统中常见)
SELECT * FROM strings WHERE type_name = 'utf16';
-- 按类型统计字符串数量
SELECT type_name, layout_name, COUNT(*) as count
FROM strings GROUP BY type_name, layout_name ORDER BY count DESC;重要提示: 对于新分析的文件(exe/dll),字符串会自动生成。对于现有数据库(i64/idb),字符串已保存。若意外出现0条字符串,执行一次重建列表。详见下方“字符串列表界面”章节。
SELECT rebuild_strings()String References (explicit join pattern)
字符串引用(显式关联模式)
Use directly. This is the canonical pattern.
strings + xrefs + funcssql
-- Find call sites/functions referencing error-like strings
SELECT
s.content as string_value,
printf('0x%X', x.from_ea) as ref_addr,
(SELECT name FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) as func_name
FROM strings s
JOIN xrefs x ON x.to_ea = s.address
WHERE s.content LIKE '%error%' OR s.content LIKE '%fail%'
ORDER BY func_name, ref_addr;
-- Functions with most string references
SELECT
(SELECT name FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) as func_name,
COUNT(*) as string_refs
FROM strings s
JOIN xrefs x ON x.to_ea = s.address
GROUP BY func_name
ORDER BY string_refs DESC
LIMIT 10;直接使用组合,这是标准模式。
strings + xrefs + funcssql
-- 查找引用错误类字符串的调用位置/函数
SELECT
s.content as string_value,
printf('0x%X', x.from_ea) as ref_addr,
(SELECT name FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) as func_name
FROM strings s
JOIN xrefs x ON x.to_ea = s.address
WHERE s.content LIKE '%error%' OR s.content LIKE '%fail%'
ORDER BY func_name, ref_addr;
-- 引用字符串最多的函数
SELECT
(SELECT name FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) as func_name,
COUNT(*) as string_refs
FROM strings s
JOIN xrefs x ON x.to_ea = s.address
GROUP BY func_name
ORDER BY string_refs DESC
LIMIT 10;SQL Functions — Byte Access (Read-Only)
SQL函数 — 字节访问(只读)
| Function | Description |
|---|---|
| Read |
| Read |
For row-shaped byte workflows, is a pure mapped-byte table:
bytessql
SELECT ea, value
FROM bytes
WHERE ea >= 0x401000 AND ea < 0x401010
ORDER BY ea;Use when you need IDA item size/type metadata.
heads| 函数 | 描述 |
|---|---|
| 读取 |
| 读取 |
对于行式字节处理流程,是纯映射字节表:
bytessql
SELECT ea, value
FROM bytes
WHERE ea >= 0x401000 AND ea < 0x401010
ORDER BY ea;当需要IDA项的大小/类型元数据时,使用。
headsBinary Search Table
二进制搜索表
Use for raw bytes/opcodes. It requires ; is an output column, not the search input.
byte_searchWHERE pattern = ...matched_hex| Column | Type | Description |
|---|---|---|
| INT | Match address |
| TEXT | Matched bytes rendered as hex text |
| BLOB | Matched bytes as raw bytes |
| INT | Match size in bytes |
| HIDDEN TEXT | Required IDA byte pattern input |
| HIDDEN INT | Optional inclusive lower bound |
| HIDDEN INT | Optional exclusive upper bound |
| HIDDEN INT | Optional generator cap |
Pattern syntax (IDA native):
- - Exact bytes (hex, space-separated)
"48 8B 05" - or
"48 ? 05"-"48 ?? 05"= any byte wildcard (whole byte only)? - - Alternatives (match any of these bytes)
"(01 02 03)"
Note: Nibble wildcards and regex are not supported in byte patterns.
Example:
sql
-- Find all matches for a pattern
SELECT address, matched_hex, size
FROM byte_search
WHERE pattern = '48 8B ? 00'
LIMIT 10;
-- First match only
SELECT printf('0x%llX', address) AS addr
FROM byte_search
WHERE pattern = 'CC CC CC'
ORDER BY address
LIMIT 1;
-- Search with alternatives
SELECT address, matched_hex
FROM byte_search
WHERE pattern = 'E8 (01 02 03 04)'
LIMIT 20;Optimization Pattern: Find functions using specific instruction
To answer "How many functions use RDTSC instruction?" efficiently:
sql
-- Count unique functions containing RDTSC (opcode: 0F 31)
SELECT COUNT(DISTINCT f.address) as count
FROM byte_search b
JOIN funcs f ON b.address >= f.address AND b.address < f.end_ea
WHERE b.pattern = '0F 31';
-- List those functions with names
SELECT DISTINCT
f.address as func_ea,
f.name as func_name
FROM byte_search b
JOIN funcs f ON b.address >= f.address AND b.address < f.end_ea
WHERE b.pattern = '0F 31';This is much faster than scanning all disassembly lines because:
- uses IDA's native binary search
byte_search - the containment join uses the compact table instead of scanning every instruction
funcs
使用查找原始字节/操作码。必须使用;是输出列,而非搜索输入。
byte_searchWHERE pattern = ...matched_hex| 列名 | 类型 | 描述 |
|---|---|---|
| INT | 匹配地址 |
| TEXT | 匹配字节的十六进制文本形式 |
| BLOB | 匹配字节的原始格式 |
| INT | 匹配结果的字节大小 |
| HIDDEN TEXT | 必填的IDA字节模式输入 |
| HIDDEN INT | 可选的包含性下界 |
| HIDDEN INT | 可选的排他性上界 |
| HIDDEN INT | 可选的结果数量上限 |
模式语法(IDA原生):
- - 精确字节(十六进制,空格分隔)
"48 8B 05" - 或
"48 ? 05"-"48 ?? 05"= 任意字节通配符(仅支持整字节)? - - 备选模式(匹配其中任意一组字节)
"(01 02 03)"
注意: 字节模式不支持半字节通配符和正则表达式。
示例:
sql
-- 查找某模式的所有匹配结果
SELECT address, matched_hex, size
FROM byte_search
WHERE pattern = '48 8B ? 00'
LIMIT 10;
-- 仅查找第一个匹配结果
SELECT printf('0x%llX', address) AS addr
FROM byte_search
WHERE pattern = 'CC CC CC'
ORDER BY address
LIMIT 1;
-- 使用备选模式搜索
SELECT address, matched_hex
FROM byte_search
WHERE pattern = 'E8 (01 02 03 04)'
LIMIT 20;优化模式:查找使用特定指令的函数
高效回答“有多少函数使用RDTSC指令?”:
sql
-- 统计包含RDTSC(操作码:0F 31)的唯一函数数量
SELECT COUNT(DISTINCT f.address) as count
FROM byte_search b
JOIN funcs f ON b.address >= f.address AND b.address < f.end_ea
WHERE b.pattern = '0F 31';
-- 列出这些函数及其名称
SELECT DISTINCT
f.address as func_ea,
f.name as func_name
FROM byte_search b
JOIN funcs f ON b.address >= f.address AND b.address < f.end_ea
WHERE b.pattern = '0F 31';这种方式比扫描所有反汇编行快得多,原因如下:
- 使用IDA原生二进制搜索
byte_search - 包含关联使用紧凑的表,而非扫描每条指令
funcs
Choose the Right Search Surface
选择合适的搜索界面
- Use for named entities such as functions, labels, structs, enums, and members.
grep - Use when the user is searching literal string contents inside the binary.
strings - Use when the target is a raw byte or opcode pattern.
byte_search
- 使用查找命名实体,如函数、标签、结构体、枚举及成员。
grep - 使用查找二进制文件中的字面字符串内容。
strings - 使用查找原始字节或操作码模式。
byte_search
SQL Surfaces — String List
SQL界面 — 字符串列表
IDA maintains a cached list of strings. Use to detect and cache strings, for the current count, and for row-level analysis.
rebuild_strings()COUNT(*) FROM stringsstrings| Surface | Description |
|---|---|
| Rebuild with ASCII + UTF-16, minlen 5 (default) |
| Rebuild with custom minimum length |
| Rebuild with custom length and type mask |
| Current string-list count (optimized without row materialization) |
Type mask values:
- = ASCII only (STRTYPE_C)
1 - = UTF-16 only (STRTYPE_C_16)
2 - = UTF-32 only (STRTYPE_C_32)
4 - = ASCII + UTF-16 (default)
3 - = All types
7
sql
-- Check current string count
SELECT COUNT(*) AS strings FROM strings;
-- Rebuild with defaults (ASCII + UTF-16, minlen 5)
SELECT rebuild_strings();
-- Rebuild with shorter minimum length
SELECT rebuild_strings(4);
-- Rebuild with specific types
SELECT rebuild_strings(5, 1); -- ASCII only
SELECT rebuild_strings(5, 7); -- All types (ASCII + UTF-16 + UTF-32)
-- Typical workflow: rebuild then query
SELECT rebuild_strings();
SELECT * FROM strings WHERE content LIKE '%error%';IMPORTANT - Agent Behavior for String Queries:
When the user asks about strings (e.g., "show me the strings", "what strings are in this binary"):
- First run to ensure strings are detected
SELECT rebuild_strings() - Then query the table
strings
The function configures IDA's string detection with sensible defaults (ASCII + UTF-16, minimum length 5) and rebuilds the string list. This ensures the user gets results even if the database had no prior string analysis.
rebuild_strings()IDA维护一个缓存的字符串列表。使用检测并缓存字符串,查看当前数量,进行行级分析。
rebuild_strings()COUNT(*) FROM stringsstrings| 界面 | 描述 |
|---|---|
| 重建字符串列表(默认包含ASCII + UTF-16,最小长度5) |
| 使用自定义最小长度重建字符串列表 |
| 使用自定义长度和类型掩码重建字符串列表 |
| 当前字符串列表数量(优化后无需行实例化) |
类型掩码值:
- = 仅ASCII(STRTYPE_C)
1 - = 仅UTF-16(STRTYPE_C_16)
2 - = 仅UTF-32(STRTYPE_C_32)
4 - = ASCII + UTF-16(默认)
3 - = 所有类型
7
sql
-- 查看当前字符串数量
SELECT COUNT(*) AS strings FROM strings;
-- 使用默认参数重建(ASCII + UTF-16,最小长度5)
SELECT rebuild_strings();
-- 使用更短的最小长度重建
SELECT rebuild_strings(4);
-- 使用特定类型重建
SELECT rebuild_strings(5, 1); -- 仅ASCII
SELECT rebuild_strings(5, 7); -- 所有类型(ASCII + UTF-16 + UTF-32)
-- 典型流程:重建后查询
SELECT rebuild_strings();
SELECT * FROM strings WHERE content LIKE '%error%';重要提示 - 字符串查询的Agent行为:
当用户询问字符串相关问题时(例如“显示所有字符串”、“这个二进制文件中有哪些字符串”):
- 首先执行确保字符串被检测到
SELECT rebuild_strings() - 然后查询表
strings
rebuild_strings()Performance Rules
性能规则
| Table/Function | Architecture | Notes |
|---|---|---|
| Cached table count path | O(1) current string-list count |
| Cached | Rebuilt on demand via |
| Native binary search table | Much faster than iterating instructions table |
| Direct read | O(1) per address, no table overhead |
Key rules:
- Always call before the first string query on a new database or after making code/data changes that may create new strings.
rebuild_strings() - uses IDA's native binary search engine; for "find functions containing opcode X", join matches to
byte_searchby containment instead of scanning thefuncstable.instructions - table is a snapshot of the cached string list. If IDA's analysis creates new strings after your initial query, call
stringsagain.rebuild_strings() - For cross-referencing strings with functions, the JOIN pattern is canonical — IDA's xref index makes the JOIN fast.
strings + xrefs + funcs
| 表/函数 | 架构 | 说明 |
|---|---|---|
| 缓存表计数路径 | O(1)时间复杂度获取当前字符串列表数量 |
| 缓存型 | 通过 |
| 原生二进制搜索表 | 比遍历指令表快得多 |
| 直接读取 | 每个地址O(1)时间复杂度,无表开销 |
核心规则:
- 在新数据库首次查询字符串前,或在修改代码/数据可能产生新字符串后,务必调用。
rebuild_strings() - 使用IDA原生二进制搜索引擎;对于“查找包含操作码X的函数”,将匹配结果与
byte_search表进行包含关联,而非扫描funcs表。instructions - 表是缓存字符串列表的快照。若IDA分析在初始查询后生成了新字符串,需再次调用
strings。rebuild_strings() - 交叉引用字符串与函数时,的关联模式是标准方式 — IDA的xref索引使关联操作速度快。
strings + xrefs + funcs
Advanced Data Patterns (CTEs)
高级数据模式(CTE)
Security-relevant string triage
安全相关字符串分类
Categorize strings by security relevance for rapid threat assessment:
sql
-- Categorize strings by security relevance
SELECT rebuild_strings();
WITH categorized AS (
SELECT address, content,
CASE
WHEN content LIKE '%password%' OR content LIKE '%passwd%' OR content LIKE '%secret%'
THEN 'credential'
WHEN content LIKE '%http://%' OR content LIKE '%https://%' OR content LIKE '%ftp://%'
THEN 'url'
WHEN content LIKE '%error%' OR content LIKE '%fail%' OR content LIKE '%exception%'
THEN 'error'
WHEN content LIKE '%debug%' OR content LIKE '%trace%' OR content LIKE '%assert%'
THEN 'debug'
WHEN content LIKE '%.exe%' OR content LIKE '%.dll%' OR content LIKE '%.sys%'
THEN 'file_path'
WHEN content LIKE '%HKEY_%' OR content LIKE '%SOFTWARE\\%'
THEN 'registry'
ELSE 'other'
END AS category
FROM strings
WHERE length >= 5
)
SELECT category, COUNT(*) AS count,
GROUP_CONCAT(SUBSTR(content, 1, 60), ' | ') AS samples
FROM categorized
WHERE category != 'other'
GROUP BY category
ORDER BY count DESC;按安全相关性对字符串分类,快速进行威胁评估:
sql
-- 按安全相关性分类字符串
SELECT rebuild_strings();
WITH categorized AS (
SELECT address, content,
CASE
WHEN content LIKE '%password%' OR content LIKE '%passwd%' OR content LIKE '%secret%'
THEN 'credential'
WHEN content LIKE '%http://%' OR content LIKE '%https://%' OR content LIKE '%ftp://%'
THEN 'url'
WHEN content LIKE '%error%' OR content LIKE '%fail%' OR content LIKE '%exception%'
THEN 'error'
WHEN content LIKE '%debug%' OR content LIKE '%trace%' OR content LIKE '%assert%'
THEN 'debug'
WHEN content LIKE '%.exe%' OR content LIKE '%.dll%' OR content LIKE '%.sys%'
THEN 'file_path'
WHEN content LIKE '%HKEY_%' OR content LIKE '%SOFTWARE\\%'
THEN 'registry'
ELSE 'other'
END AS category
FROM strings
WHERE length >= 5
)
SELECT category, COUNT(*) AS count,
GROUP_CONCAT(SUBSTR(content, 1, 60), ' | ') AS samples
FROM categorized
WHERE category != 'other'
GROUP BY category
ORDER BY count DESC;Combine string references with function size for suspicion scoring
结合字符串引用与函数大小进行可疑度评分
Functions referencing security-relevant strings AND having significant size are high-priority targets:
sql
-- Suspicious functions: reference interesting strings AND are non-trivial
WITH interesting_strings AS (
SELECT address, content FROM strings
WHERE content LIKE '%password%' OR content LIKE '%encrypt%'
OR content LIKE '%decrypt%' OR content LIKE '%http%'
OR content LIKE '%socket%' OR content LIKE '%connect%'
),
string_funcs AS (
SELECT DISTINCT (SELECT address FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) AS func_addr,
s.content AS matched_string
FROM interesting_strings s
JOIN xrefs x ON x.to_ea = s.address
WHERE (SELECT address FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) IS NOT NULL
)
SELECT (SELECT name FROM funcs WHERE sf.func_addr >= address AND sf.func_addr < end_ea LIMIT 1) AS func_name,
printf('0x%X', sf.func_addr) AS addr,
f.size AS func_size,
GROUP_CONCAT(sf.matched_string, ' | ') AS strings_referenced
FROM string_funcs sf
JOIN funcs f ON f.address = sf.func_addr
GROUP BY sf.func_addr
ORDER BY f.size DESC
LIMIT 20;引用安全相关字符串且体积较大的函数是高优先级分析目标:
sql
-- 可疑函数:引用敏感字符串且体积较大
WITH interesting_strings AS (
SELECT address, content FROM strings
WHERE content LIKE '%password%' OR content LIKE '%encrypt%'
OR content LIKE '%decrypt%' OR content LIKE '%http%'
OR content LIKE '%socket%' OR content LIKE '%connect%'
),
string_funcs AS (
SELECT DISTINCT (SELECT address FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) AS func_addr,
s.content AS matched_string
FROM interesting_strings s
JOIN xrefs x ON x.to_ea = s.address
WHERE (SELECT address FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) IS NOT NULL
)
SELECT (SELECT name FROM funcs WHERE sf.func_addr >= address AND sf.func_addr < end_ea LIMIT 1) AS func_name,
printf('0x%X', sf.func_addr) AS addr,
f.size AS func_size,
GROUP_CONCAT(sf.matched_string, ' | ') AS strings_referenced
FROM string_funcs sf
JOIN funcs f ON f.address = sf.func_addr
GROUP BY sf.func_addr
ORDER BY f.size DESC
LIMIT 20;Find functions referencing both crypto-related and network-related strings
查找同时引用加密相关和网络相关字符串的函数
Cross-category correlation for identifying data exfiltration or C2 communication:
sql
-- Functions touching both crypto and network strings
WITH crypto_refs AS (
SELECT DISTINCT (SELECT address FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) AS func_addr
FROM strings s JOIN xrefs x ON x.to_ea = s.address
WHERE s.content LIKE '%crypt%' OR s.content LIKE '%aes%'
OR s.content LIKE '%cipher%' OR s.content LIKE '%hash%'
),
network_refs AS (
SELECT DISTINCT (SELECT address FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) AS func_addr
FROM strings s JOIN xrefs x ON x.to_ea = s.address
WHERE s.content LIKE '%socket%' OR s.content LIKE '%connect%'
OR s.content LIKE '%send%' OR s.content LIKE '%recv%'
OR s.content LIKE '%http%'
)
SELECT (SELECT name FROM funcs WHERE c.func_addr >= address AND c.func_addr < end_ea LIMIT 1) AS func_name,
printf('0x%X', c.func_addr) AS addr
FROM crypto_refs c
JOIN network_refs n ON n.func_addr = c.func_addr;跨类别关联以识别数据泄露或C2通信行为:
sql
-- 同时涉及加密和网络字符串的函数
WITH crypto_refs AS (
SELECT DISTINCT (SELECT address FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) AS func_addr
FROM strings s JOIN xrefs x ON x.to_ea = s.address
WHERE s.content LIKE '%crypt%' OR s.content LIKE '%aes%'
OR s.content LIKE '%cipher%' OR s.content LIKE '%hash%'
),
network_refs AS (
SELECT DISTINCT (SELECT address FROM funcs WHERE x.from_ea >= address AND x.from_ea < end_ea LIMIT 1) AS func_addr
FROM strings s JOIN xrefs x ON x.to_ea = s.address
WHERE s.content LIKE '%socket%' OR s.content LIKE '%connect%'
OR s.content LIKE '%send%' OR s.content LIKE '%recv%'
OR s.content LIKE '%http%'
)
SELECT (SELECT name FROM funcs WHERE c.func_addr >= address AND c.func_addr < end_ea LIMIT 1) AS func_name,
printf('0x%X', c.func_addr) AS addr
FROM crypto_refs c
JOIN network_refs n ON n.func_addr = c.func_addr;