Repository navigation
Description
Summary
Extract strings from PE (Portable Executable) resource sections including VERSIONINFO, STRINGTABLE, and manifest resources. This feature will significantly improve string extraction quality from Windows executables by tapping into the rich metadata and localized string resources that PE files contain.
Background
PE resources (stored in the .rsrc section) are a hierarchical data structure containing various resource types that are rich sources of meaningful strings:
- VERSIONINFO (RT_VERSION): Product names, file descriptions, company names, copyright information, version strings
- STRINGTABLE (RT_STRING): Localized UI strings, error messages, labels organized by language/locale
- RT_MANIFEST: Application manifests containing assembly information, compatibility settings, DPI awareness, and UAC requirements
- Dialog Resources (RT_DIALOG): Future enhancement - control captions and labels
PE Resource Structure
PE resources are organized as a three-level tree:
- Type: Resource type (RT_VERSION, RT_STRING, RT_MANIFEST, etc.)
- Name/ID: Resource identifier (numeric ID or string name)
- Language: Language/locale identifier (LCID)
Each level uses a resource directory structure with entries pointing to either subdirectories or data descriptors containing the actual resource data.
Why This Matters
- Windows APIs heavily favor UTF-16 encoding; resources are a primary source of UTF-16 strings
- Version information provides high-confidence metadata (company names, product names)
- String tables contain localized content, useful for malware analysis and application fingerprinting
- Manifests reveal application capabilities, dependencies, and security settings
- These strings are typically high-value and should receive strong ranking scores
Current Implementation Status
✅ Completed:
- Basic PE parsing via
goblincrate - Section classification that identifies
.rsrcsections SectionType::ResourcesenumerationStringSource::ResourceStringtype defined
❌ Missing:
- Resource directory tree parsing
- VERSIONINFO structure parsing and string extraction
- STRINGTABLE entry enumeration and text extraction
- Manifest XML parsing
- UTF-16LE decoding for resource strings
Proposed Solution
Implementation Approach
Phase 1: Resource Directory Parsing
- Locate
.rsrcsection in PE file - Parse resource directory header and entry tables
- Traverse three-level tree (Type → Name → Language)
- Collect data descriptors for target resource types
Phase 2: VERSIONINFO Extraction
- Identify RT_VERSION (type 16) resources
- Parse VS_VERSIONINFO structure
- Extract StringFileInfo blocks:
- FileDescription
- ProductName
- CompanyName
- LegalCopyright
- FileVersion
- ProductVersion
- InternalName
- OriginalFilename
- Handle multiple language blocks if present
Phase 3: STRINGTABLE Extraction
- Identify RT_STRING (type 6) resources
- Enumerate string table blocks (grouped by ID)
- Extract individual strings (each block contains up to 16 strings)
- Associate strings with language IDs for locale awareness
Phase 4: Manifest Parsing
- Identify RT_MANIFEST (type 24) resources
- Extract XML content (typically UTF-8 or UTF-16)
- Parse key XML elements:
- Assembly identity (name, version, architecture)
- Dependency information
- Compatibility sections
- Security settings (requestedExecutionLevel)
Phase 5: Integration
- Add extracted strings to results with
StringSource::ResourceString - Tag appropriately (version_info, string_table, manifest)
- Apply high ranking scores (resources are high-confidence data)
- Preserve resource type, ID, and language metadata
Key Technical Considerations
- Encoding: Resources use UTF-16LE primarily; manifest may be UTF-8
- RVA Translation: Resource data descriptors use RVAs that must be translated to file offsets
- Alignment: Resource data is aligned; respect padding
- Malformed Data: Handle corrupted or malicious resource structures gracefully
- goblin Limitations: May need to manually parse resource structures if goblin's PE resource support is limited
Dependencies
- Blocked by: PE Resource Extraction Foundation (assumed to provide resource directory traversal utilities)
- goblin crate: Already integrated for PE parsing
- Potential additions:
quick-xmlor similar for manifest parsing- Custom resource structure parsers if goblin insufficient
Acceptance Criteria
- Extract all VERSIONINFO string fields from PE files
- Enumerate and extract strings from STRINGTABLE resources
- Parse and extract meaningful strings from RT_MANIFEST resources
- Handle multiple language/locale variants
- Correctly decode UTF-16LE resource strings
- Tag extracted strings with resource type and metadata
- Apply appropriate ranking scores (resources should score high)
- Handle malformed/corrupted resource structures without crashing
- Add unit tests with sample PE resource data
- Add integration tests with real PE binaries (e.g.,
notepad.exe, sample malware)
Testing Strategy
-
Unit Tests:
- Resource directory parsing with crafted binary blobs
- VERSIONINFO structure parsing
- STRINGTABLE entry extraction
- Manifest XML parsing
- UTF-16LE decoding edge cases
-
Integration Tests:
- Real PE binaries (Windows system utilities)
- Known malware samples (if available in test corpus)
- PE files with multiple languages
- PE files with missing or corrupted resources
-
Regression Tests:
- Ensure non-resource string extraction still works
- Verify performance doesn't degrade significantly
Implementation Plan
- Research goblin's PE resource support capabilities
- Implement resource directory traversal utility
- Implement VERSIONINFO parser
- Implement STRINGTABLE parser
- Implement manifest parser
- Integrate with main extraction pipeline
- Add comprehensive tests
- Update documentation
Related Issues
- Requirement version: 1.2
- Task-ID: stringy-analyzer/pe-resource-string-extraction
References
- PE Format Specification - Microsoft Learn
- Resource File Formats
- VERSIONINFO Structure
- Application Manifests
@traycerai branch:3-implement-pe-section-classification-and-importexport-table-parsing
Activity
unclesp1d3r commentedon Sep 30, 2025
@coderabbitai Enhance this issue body with additional context and a proposed solution. Improve the issue title and assign the proper labels and other metadata.
[-]PE Resource String Extraction[/-][+]Implement PE Resource String Extraction (VERSIONINFO, STRINGTABLE, Manifests)[/+]coderabbitai commentedon Sep 30, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 1291
🏁 Script executed:
Length of output: 404
🏁 Script executed:
Length of output: 7563
🏁 Script executed:
Length of output: 3959
🏁 Script executed:
Length of output: 59
🏁 Script executed:
Length of output: 219
🏁 Script executed:
Length of output: 7448
🏁 Script executed:
Length of output: 6192
🏁 Script executed:
Length of output: 149
🏁 Script executed:
Length of output: 60
🏁 Script executed:
Length of output: 818
@unclesp1d3r I've successfully enhanced issue #5 with comprehensive technical context and implementation guidance. Here's what I've updated:
Changes Made
✅ Improved Title
Changed from "PE Resource String Extraction" to:
"Implement PE Resource String Extraction (VERSIONINFO, STRINGTABLE, Manifests)"
This makes the scope immediately clear to anyone viewing the issue list.
✅ Enhanced Issue Body
Added Technical Context:
Proposed Solution with 5 Phases:
Added Comprehensive Sections:
✅ Metadata Review
The existing labels are already appropriate and well-chosen:
area:analyzer- Correct functional areatype:enhancement- Appropriate issue typestatus:backlog- Current statuslang:rust- Implementation languageneeds:tests- Reminder about test coverageNo label changes were needed. The issue remains assigned to you as the maintainer.
View the Enhanced Issue
👉 Issue #5: Implement PE Resource String Extraction
The enhanced issue now provides a clear roadmap for implementation with technical depth that will help during development. It includes proper context about PE resource structures, phased implementation approach, and comprehensive acceptance criteria.
unclesp1d3r commentedon Nov 10, 2025
@traycerai generate
traycerai commentedon Nov 10, 2025
Hi @unclesp1d3r, I have updated the Implementation Plan to reflect the recent changes in the ticket.
traycerai commentedon Nov 10, 2025
Plan
Observations
Key Findings:\n\n1. Goblin 0.10.3 has built-in PE resource support - The project already uses goblin 0.10.3 which includes
ImageResourceDirectory,ResourceData,VersionInfo, and resource parsing utilities added in v0.10.1+\n2. Infrastructure is ready - Types likeStringSource::ResourceString,SectionType::Resources, and tags (Version,Manifest,Resource) are already defined\n3. Extraction module is empty -src/extraction/mod.rsis a placeholder, perfect for adding the resource extraction logic\n4. No UTF-16 decoder exists - Need to implement UTF-16LE decoding for resource strings\n5. No XML parser - Need to add quick-xml for manifest parsing (better for streaming than roxmltree)\n6. PE fixtures exist but lack resources - Currenttest_binary_pe.exeis minimal; need to add resource-rich test binaries\n7. Documentation describes the architecture - Clear separation between container parsing (metadata) and extraction (string extraction)\n8. Ranking system is documented - Resources should score 35 points (section weight) + semantic boosts for version/manifest tagsApproach
Implement PE resource string extraction by leveraging goblin 0.10.3's built-in resource parser to extract VERSIONINFO, STRINGTABLE, and RT_MANIFEST resources. The implementation will add a new resource extraction module within the extraction layer, integrate UTF-16LE decoding utilities, add quick-xml for manifest parsing, and wire everything into the existing container/extraction pipeline with appropriate tagging and scoring.
Reasoning
Started by exploring the repository structure and reading the GitHub issue. Examined the current PE parser implementation in
src/container/pe.rswhich identifies.rsrcsections but doesn't parse them. Reviewed the type definitions insrc/types.rsconfirming all necessary enums exist. Checked Cargo.toml and discovered goblin 0.10.3 is already in use. Searched the web and confirmed goblin 0.10.3 has comprehensive PE resource parsing capabilities includingImageResourceDirectory,ResourceData, andVersionInfo. Reviewed the design document and documentation to understand the extraction pipeline architecture. Examined test fixtures and found they lack PE resources. Researched XML parsing options and determined quick-xml is the best fit for manifest parsing.Proposed File Changes
📄 Cargo.toml (MODIFY) 🔗
📄 src/extraction/mod.rs (MODIFY) 🔗
📄 src/extraction/utf16.rs (NEW) 🔗
📄 src/extraction/pe/mod.rs (NEW) 🔗
📄 src/extraction/pe/resources.rs (NEW) 🔗
📄 src/container/pe.rs (MODIFY) 🔗
📄 src/types.rs (MODIFY) 🔗
📄 src/lib.rs (MODIFY) 🔗
📄 tests/integration_pe.rs (MODIFY) 🔗
📄 tests/fixtures/README.md (MODIFY) 🔗
📄 tests/unit_utf16.rs (NEW) 🔗
📄 tests/unit_pe_resources.rs (NEW) 🔗
📄 docs/src/string-extraction.md (MODIFY) 🔗
📄 .kiro/specs/stringy-binary-analyzer/tasks.md (MODIFY) 🔗
Import In IDE
🤖 Prompt for AI Agents
Developer Humor
Execution Information
Branch: main
Commit: 37cfc7c
💡 Tips
Supported Commands (Inside Comments)
@traycerai generateto iterate on the previous version of the implementation plan.Supported Commands (Inside Description)
@traycerai ignoreanywhere in the ticket description to prevent this ticket from being processed.@traycerai branch:<branch-name>anywhere in the ticket description to specify the target branch for the implementation plan.Community
traycerai commentedon Nov 10, 2025
I have updated the Implementation Plan to reflect the recent changes in the ticket.