Repository navigation
Description
Context
Windows PE (Portable Executable) binaries contain a resource section () with rich metadata and embedded strings that are currently not being extracted by Stringy. While the PE parser already identifies resource sections and assigns them high weight (9.0), it does not parse the internal resource directory structure to extract the actual strings contained within.
The PE resource section uses a hierarchical directory structure with three levels:
- Type - Resource type (e.g., RT_VERSION, RT_MANIFEST, RT_STRING, RT_DIALOG, RT_MENU)
- Name/ID - Resource name or numeric identifier
- Language - Language ID for localization
Current State
The existing PE parser (src/container/pe.rs) already:
- ✅ Identifies the
.rsrcsection withSectionType::Resources - ✅ Assigns high weight (9.0) to resource sections
- ✅ Extracts import/export tables
- ✅ Has semantic tags defined (
Tag::Resource,Tag::Version,Tag::Manifest) - ✅ Has
StringSource::ResourceStringvariant in types
What's Missing:
- ❌ Parsing the PE resource directory structure
- ❌ Extracting version information fields
- ❌ Extracting manifest XML content
- ❌ Processing STRINGTABLE resources
- ❌ Extracting strings from dialog and menu definitions
Proposed Solution
1. Resource Directory Parsing
Implement a resource directory parser that traverses the hierarchical structure within the .rsrc section:
// Parse resource directory tree
fn parse_resource_directory(&self, pe: &PE, data: &[u8]) -> Vec<ResourceEntry> {
// Navigate Type → Name → Language hierarchy
// Extract resource data for relevant types
}2. Version Information Extraction
Parse RT_VERSION resources (VS_VERSIONINFO structure):
- Fixed version info: File/product versions, flags, OS, file type
- Variable version info (StringFileInfo):
FileDescription- File purpose/descriptionProductName- Product nameCompanyName- Company/publisherLegalCopyright- Copyright noticeOriginalFilename- Original file nameInternalName- Internal component nameFileVersion/ProductVersion- Version strings
Semantic tagging: Tag::Version, Tag::Resource
Scoring: Assign high scores (8.0-10.0) as these are high-signal strings
3. Manifest Extraction
Parse RT_MANIFEST resources (embedded XML):
- Extract manifest as XML string
- Optionally extract specific fields:
- Assembly identity (name, version, architecture)
- Requested execution level
- Compatibility information
- Dependencies
Semantic tagging: Tag::Manifest, Tag::Resource
Scoring: High score (8.0-9.0) for manifest strings
4. String Table Resources
Parse RT_STRING resources:
- String tables contain 16 strings per block
- Strings are length-prefixed UTF-16LE
- Used for UI strings, error messages, prompts
Semantic tagging: Tag::Resource
Scoring: Medium-high score (6.0-7.0)
5. Dialog and Menu Definitions
Parse RT_DIALOG and RT_MENU resources:
- Extract window titles, button labels, menu items
- Parse dialog templates (DLGTEMPLATE / DLGTEMPLATEEX)
- Parse menu templates (MENUITEMTEMPLATE)
Semantic tagging: Tag::Resource
Scoring: Medium score (5.0-6.0)
Implementation Considerations
Using goblin Crate
The project uses goblin for PE parsing. Check its capabilities:
- Does goblin expose resource directory parsing?
- May need to implement custom resource parsing if goblin doesn't support it
- Resource directories are referenced via
IMAGE_DIRECTORY_ENTRY_RESOURCEin the PE optional header
Error Handling
- Resource sections may be malformed or obfuscated
- Handle missing or invalid resource entries gracefully
- Validate resource directory offsets and sizes to prevent out-of-bounds reads
Unicode Handling
- Most PE resources use UTF-16LE encoding
- Version info and string tables are UTF-16LE
- Manifests are typically UTF-8 XML
Performance
- Resource parsing should be efficient for large binaries
- Consider lazy parsing or optional flags to enable/disable resource extraction
- Balance thoroughness with performance for deeply nested resource structures
Acceptance Criteria
- Parse PE resource directory structure (Type → Name → Language hierarchy)
- Extract version info fields (
FileDescription,ProductName,CompanyName,FileVersion, etc.) - Extract manifest XML strings from
RT_MANIFESTresources - Handle
RT_STRING(STRINGTABLE) resources with length-prefixed UTF-16LE strings - Extract strings from
RT_DIALOGandRT_MENUresources - Add appropriate semantic tagging (
Tag::Resource,Tag::Version,Tag::Manifest) - Include resource strings in scoring/ranking system with appropriate weights
- Add unit tests for resource parsing logic
- Add integration tests with real PE binaries containing resources
- Handle malformed or missing resource sections gracefully
- Document resource extraction in user-facing documentation
Technical References
- PE Format Specification: Microsoft PE and COFF Specification
- Resource Directory: IMAGE_RESOURCE_DIRECTORY structure
- Version Resources: VS_VERSIONINFO structure
- String Tables: RT_STRING resource format
- goblin Documentation: Check for resource directory support
Related Files
src/container/pe.rs- PE parser implementationsrc/types.rs- Type definitions (Tag, StringSource, SectionType)tests/integration_pe.rs- Integration tests for PE parsing
References
Parent Epic: Epic: v0.2 - PE Resources, Symbol Demangling & Import/Export Enhancement
Activity
traycerai commentedon Nov 10, 2025
Warning
Rate limit exceeded. Please try after 519 seconds.
unclesp1d3r commentedon Nov 10, 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.
[-]Advanced PE Resources Extraction[/-][+]Extract Strings from PE Resource Directory (Version Info, Manifests, String Tables, Dialogs)[/+]coderabbitai commentedon Nov 10, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 9038
🏁 Script executed:
Length of output: 16764
🏁 Script executed:
Length of output: 227
🏁 Script executed:
Length of output: 341
@unclesp1d3r I've successfully enhanced issue #56 with comprehensive technical details and proper metadata! Here's what was updated:
📝 Changes Made
Title Enhancement
Before: "Advanced PE Resources Extraction"
After: "Extract Strings from PE Resource Directory (Version Info, Manifests, String Tables, Dialogs)"
The new title is more specific and clearly describes the scope of work.
Issue Body Enhancements
Added "Current State" Section - Documents what's already implemented in the PE parser (resource section identification, semantic tags, etc.) vs. what's missing (actual parsing)
Expanded Proposed Solution with detailed subsections:
Added Implementation Considerations:
Enhanced Acceptance Criteria - More specific and testable items including unit tests, integration tests, and documentation
Added Technical References - Links to Microsoft PE specification, resource structures, and related documentation
Added Related Files Section - Points to relevant source files for implementation
Labels Added
area:analyzer- Binary analyzer functionalitylang:rust- Rust implementationneeds:tests- Requires test coveragepriority:medium- Medium priority taskPreserved Metadata
🔗 View the updated issue: #56
The issue is now much more actionable with clear technical guidance for implementing PE resource extraction!
unclesp1d3r commentedon Jul 4, 2026
Implemented: PE resource extraction in src/extraction/pe_resources/ (version_info, string_tables, manifests, detection + tests). Duplicate of #57. Closing as completed.