Repository navigation
Open
Feature
0 / 30 of 3 issues completed
Copy link
Labels
area:analyzerBinary analyzer functionalityBinary analyzer functionalityenhancementNew feature or requestNew feature or requestepicLarge feature or initiative spanning multiple tasksLarge feature or initiative spanning multiple taskslang:rustRust implementationRust implementationpriority:mediumMedium priority taskMedium priority task
Description
Overview
This epic tracks the implementation of architecture-specific features for binary analysis in StringyMcStringFace. Different CPU architectures have unique characteristics that affect string extraction, code analysis, and metadata interpretation. Supporting these features will improve analysis accuracy and enable better detection of architecture-specific patterns.
Current State
StringyMcStringFace currently supports three major binary formats across multiple architectures:
- x86-64: Full support for Linux (ELF), macOS (Mach-O), and Windows (PE)
- ARM64/aarch64: Support for Apple Silicon (Mach-O) and Linux (ELF)
- Build targets:
aarch64-apple-darwin,aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,x86_64-pc-windows-msvc
The architecture support is primarily format-driven rather than feature-driven, meaning we parse binaries but don't fully leverage architecture-specific characteristics.
Problem Statement
Different architectures have unique features that impact string analysis:
- Pointer Encoding: ARM64 uses pointer authentication and tagged pointers that can obscure string references
- Addressing Modes: x86-64 RIP-relative addressing provides hints about string locations
- Instruction Sets: Architecture-specific instructions may reference strings differently
- Multi-Architecture Binaries: Mach-O fat binaries contain multiple architectures that should be analyzed separately
- Emerging Architectures: RISC-V support is growing and needs consideration
Without architecture-aware analysis, we may:
- Miss string references that use architecture-specific pointer encoding
- Incorrectly identify data as code or vice versa
- Fail to extract strings from all architectures in fat binaries
- Produce suboptimal scoring for architecture-specific sections
Proposed Solutions
1. Architecture Detection and Metadata
- Add architecture field to binary metadata
- Detect endianness and word size from binary headers
- Report architecture information in output formats
- Support architecture filtering in CLI (
--archflag)
2. ARM64-Specific Features
- Pointer Authentication (PAC): Strip authentication codes from pointers before dereferencing
- Tagged Pointers: Handle top-byte ignored (TBI) addressing
- Load/Store Analysis: Identify string loads using ARM64 instruction patterns
- Section Characteristics: Weight ARM64-specific sections appropriately
3. x86-64 Optimizations
- RIP-Relative Addressing: Identify string references from RIP-relative LEA instructions
- String Instruction Patterns: Detect common x86-64 string manipulation patterns
- PE-Specific: Handle x86-64 exception handling and unwind information
4. RISC-V Support (See #75)
- Establish foundation for RISC-V binary analysis
- Define RISC-V-specific section scoring
- Support both RV64 and RV32 variants
5. Multi-Architecture Binary Handling
- Enhance Mach-O fat binary processing to analyze all architectures
- Add
--macho-arch <arch>flag for specific architecture selection - Report which architecture each string was extracted from
- Deduplicate strings across architectures with source tracking
6. Architecture-Aware Scoring
- Adjust section scoring based on architecture characteristics
- Weight code vs data sections differently per architecture
- Consider architecture-specific calling conventions
Sub-Issues and Tasks
- Add RISC-V architecture-specific string extraction support #75 - RISC-V: Emerging architecture support
- Implement ARM64 pointer authentication handling
- Add architecture detection and metadata reporting
- Enhance fat binary processing for multi-architecture analysis
- Implement x86-64 RIP-relative string reference detection
- Add architecture-aware section scoring
- Create architecture-specific test fixtures
- Document architecture-specific features and limitations
Success Criteria
- Completeness: All supported architectures have dedicated feature detection
- Accuracy: Architecture-specific pointer encodings are correctly handled
- Reporting: Output clearly indicates which architecture strings came from
- Testing: Comprehensive test coverage for each supported architecture
- Documentation: Clear documentation of architecture-specific capabilities
Technical Considerations
- Use
objectcrate's architecture detection capabilities - Consider optional Capstone integration for instruction-level analysis (see Implement Capstone Disassembly Pass to Identify Code-Referenced Strings #61, Add relocation-hinted string reference detection with Capstone disassembly #41)
- Maintain trait-based design for extensibility
- Keep architecture-specific code modular and well-documented
- Ensure cross-platform testing (CI/CD covers all target platforms)
Related Issues
- Add RISC-V architecture-specific string extraction support #75 - RISC-V support
- Implement Capstone Disassembly Pass to Identify Code-Referenced Strings #61 - Capstone disassembly for code-referenced strings
- Parse Mach-O Load Commands for Dynamic Library and Framework Path Extraction #63 - Mach-O load command parsing
- Add relocation-hinted string reference detection with Capstone disassembly #41 - Relocation-hinted string detection
References
- Documentation:
docs/src/binary-formats.md- Architecture-Specific Features section - Build targets:
dist-workspace.tomlanddeny.toml - Test fixtures:
tests/fixtures/with architecture-specific binaries
Metadata
Metadata
Assignees
Labels
area:analyzerBinary analyzer functionalityBinary analyzer functionalityenhancementNew feature or requestNew feature or requestepicLarge feature or initiative spanning multiple tasksLarge feature or initiative spanning multiple taskslang:rustRust implementationRust implementationpriority:mediumMedium priority taskMedium priority task
Activity
traycerai commentedon Nov 11, 2025
Plan
Observations
The enhanced issue #72 provides a clear phased approach for architecture detection and multi-architecture support. The codebase uses goblin for parsing, which supports extracting architecture information from all three formats. The current Mach-O parser only handles the first architecture in fat binaries, as noted in the TODO. The CLI is basic with clap, making it straightforward to add architecture selection flags. Integration tests exist for each format, which can be extended to verify multi-architecture parsing. This enhancement aligns with requirements for format-specific knowledge and prepares for future architecture-specific optimizations.
Approach
Implement architecture awareness in two phases: (1) Add architecture and endianness detection to the data model and individual parsers, updating the output to include this metadata; (2) Enhance Mach-O fat binary handling to parse all architectures, add CLI flags for selection, and support multi-architecture analysis by returning a collection of ContainerInfo instances. This maintains backward compatibility by treating single-architecture binaries as collections of one, enabling incremental adoption without breaking existing functionality.
Reasoning
Explored the repository structure and key files including
src/main.rsfor CLI setup,src/container/mod.rsfor the parser trait, individual parser implementations (elf.rs,pe.rs,macho.rs), type definitions intypes.rs, existing integration tests, documentation, and task tracking in.kiro/specs/. Confirmed goblin provides architecture details and identified the need to update the parser trait for multi-architecture support.Proposed File Changes
📄 src/types.rs (MODIFY) 🔗
📄 src/container/mod.rs (MODIFY) 🔗
📄 src/container/elf.rs (MODIFY) 🔗
📄 src/container/pe.rs (MODIFY) 🔗
📄 src/container/macho.rs (MODIFY) 🔗
📄 src/main.rs (MODIFY) 🔗
📄 tests/integration_elf.rs (MODIFY) 🔗
📄 tests/integration_pe.rs (MODIFY) 🔗
📄 tests/integration_macho.rs (MODIFY) 🔗
📄 README.md (MODIFY) 🔗
📄 docs/src/architecture.md (MODIFY) 🔗
📄 docs/src/SUMMARY.md (MODIFY) 🔗
📄 .kiro/specs/stringy-binary-analyzer/tasks.md (MODIFY) 🔗
Diagram
sequenceDiagram participant User participant CLI participant Detector as Format Detector participant Parser as Container Parser participant Containers as Vec<ContainerInfo> participant Extractor as String Extractor participant Output as Output Formatter User->>CLI: stringy [flags] binary_file Note over CLI: --arch=arm64 or --all-arches CLI->>Detector: detect_format(data) Detector-->>CLI: BinaryFormat::MachO CLI->>Parser: create_parser(format) Parser->>Parser: parse(data) alt Single Architecture (ELF/PE/Mach-O thin) Parser->>Parser: detect_arch_endian() Parser->>Containers: vec![ContainerInfo {arch, endian, ...}] else Fat Binary (Mach-O universal) loop for each arch in fat.archs Parser->>Parser: parse_single_slice(slice) Parser->>Parser: detect_arch_endian_for_slice() Parser->>Containers: push ContainerInfo {arch, endian, ...} end end CLI->>Containers: filter_by_arch(if --arch) or take_all(if --all-arches) or first(default) Containers-->>CLI: filtered_vec loop for each container in filtered_vec CLI->>Extractor: extract_strings(container) Extractor-->>CLI: strings_with_arch Attribution end CLI->>Output: format(strings, containers) alt JSON Output->>User: [{"arch": "X86_64", "strings": [...]}, {"arch": "ARM64", "strings": [...]}] else Human-readable Output->>User: Architecture: X86_64 (little-endian)\nStrings: ...\n---\nArchitecture: ARM64 (little-endian)\nStrings: ... endImport In IDE
🤖 Prompt for AI Agents
Developer Humor
Execution Information
Branch: main
Commit: 08cd31b
💡 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
unclesp1d3r commentedon Nov 11, 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.
[-]Architecture-Specific Features[/-][+]Epic: Architecture-Specific Binary Analysis Features[/+]coderabbitai commentedon Nov 11, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 290
🏁 Script executed:
Length of output: 15943
🏁 Script executed:
Length of output: 3217
🏁 Script executed:
Length of output: 61
@unclesp1d3r I've successfully enhanced issue #72! Here's what was updated:
✨ Key Changes
Title Enhanced:
Architecture-Specific FeaturesEpic: Architecture-Specific Binary Analysis FeaturesComprehensive Body Added:
Metadata Applied:
epic,enhancement,area:analyzer,lang:rust,priority:mediumThe issue is now structured as a comprehensive epic that provides clear context, actionable tasks, and technical direction for implementing architecture-specific binary analysis features. 🎯
View the enhanced issue: #72
unclesp1d3r commentedon Nov 11, 2025
Title: Add CPU Architecture Detection and Multi-Architecture Support
Problem Statement
StringyMcStringFace currently lacks CPU architecture awareness, which limits its ability to:
The goblin library provides architecture information that we're not currently capturing or exposing to users.
Current Limitations
1. No Architecture Information in Output
The
ContainerInfostruct captures binary format (ELF/PE/Mach-O) but doesn't include CPU architecture details:elf.header.e_machinecontains machine type (EM_X86_64, EM_AARCH64, etc.)pe.header.coff_header.machinecontains machine type (IMAGE_FILE_MACHINE_AMD64, IMAGE_FILE_MACHINE_ARM64, etc.)macho.header.cputypeandcpusubtypecontain CPU type information2. Limited Fat Binary Support
The Mach-O parser (line 305 in
src/container/macho.rs) only parses the first architecture in fat/universal binaries:This means users analyzing universal binaries only see strings from one architecture, potentially missing architecture-specific strings.
3. No Endianness Handling
Different architectures use different byte orders (big-endian vs little-endian), which affects:
Proposed Solution
Phase 1: Architecture Detection and Reporting
Add Architecture Type to Data Model
Architectureenum insrc/types.rswith variants for common architectures:X86,X86_64,ARM,ARM64,RISC_V,PowerPC,MIPS, etc.Unknown(String)for unsupported architecturesAdd Architecture Field to ContainerInfo
architecture: Architecturefield toContainerInfostructendianness: Endiannessenum (Little, Big) fieldExtract Architecture from Binary Headers
e_machinevalues toArchitectureenumArchitectureenumcputypevalues toArchitectureenumInclude Architecture in Output
Phase 2: Multi-Architecture Binary Support
Parse All Architectures in Fat Binaries
ContainerInfofor each architecture, orContainerInfoto support multi-architecture dataCLI Options for Architecture Selection
--archflag to select specific architecture from fat binaries--all-archsflag to analyze all architecturesPhase 3: Architecture-Specific String Extraction (Future)
Endianness-Aware String Extraction
Architecture-Specific Section Handling
Architecture-Specific Heuristics
Implementation Plan
Step 1: Define Architecture Types
Architectureenum tosrc/types.rsEndiannessenum tosrc/types.rsContainerInfostructContainerInfo::new()constructorStep 2: Extract Architecture from ELF
e_machinevalues toArchitectureenum insrc/container/elf.rse_ident[EI_DATA])Step 3: Extract Architecture from PE
Architectureenum insrc/container/pe.rsStep 4: Extract Architecture from Mach-O
cputypevalues toArchitectureenum insrc/container/macho.rsStep 5: Update Output Formats
Step 6: Multi-Architecture Support (Mach-O)
Benefits
Testing Strategy
Related Issues
src/container/macho.rsline 305Labels: enhancement, good first issue, help wanted
Assignees: (leave unassigned for now)
Milestone: v0.2 (or appropriate milestone)
unclesp1d3r commentedon Nov 11, 2025
Request: Change issue title to "Add CPU Architecture Detection and Multi-Architecture Support" and add labels: enhancement, good first issue, help wanted.
I can update the issue title and labels if I have repository write permissions. Please confirm and, if granted, I will apply the changes now. If you prefer, I can also open a small PR that updates project metadata/docs referencing the issue.
unclesp1d3r commentedon Nov 11, 2025
Request received: set title to "Add CPU Architecture Detection and Multi-Architecture Support" and labels [enhancement, good first issue, help wanted].
I don't have repository write permissions in this environment to update the issue metadata (title/labels) directly. If you can grant the app/bot write access I will make the change, or you can run the following quick steps locally or in the GitHub UI:
If you prefer I can open a small PR that updates repository docs/issue templates referencing this issue or prepare a branch that implements the first-step code changes (types + enums) and open a PR titled "feat: add architecture detection types" — tell me which you prefer and I will proceed.
traycerai commentedon Nov 11, 2025
I have updated the Implementation Plan to reflect the recent changes in the ticket.