diff --git a/CHANGELOG.md b/CHANGELOG.md index d94ec78..c241855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable public changes to HexScry will be documented here. The project follows Semantic Versioning once public prereleases begin. +## 0.1.0-alpha.2 + +- Click a mapped printable string after deep analysis to inspect its references. Click an incoming source address to inspect the instruction using it. +- Follow a real bzip2recover investigation in the walkthrough linked from the README. +- Java probe timeouts now identify the slow check and omit unrelated provider diagnostics. + ## 0.1.0-alpha.1 ### Added diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 4054e5d..c84e271 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@hexscry/desktop", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "private": true, "description": "Evidence-first reverse engineering workbench.", "author": "HexScry contributors", diff --git a/apps/desktop/src/renderer/src/App.tsx b/apps/desktop/src/renderer/src/App.tsx index ff3f58a..6dc3443 100644 --- a/apps/desktop/src/renderer/src/App.tsx +++ b/apps/desktop/src/renderer/src/App.tsx @@ -148,7 +148,11 @@ function HexComparison({ window, report }: { window: HexWindowResult; report: Bi ); } -function InstructionView({ instruction }: { instruction: InstructionInspection }) { +function InstructionView({ instruction, onNavigate, busy }: { + instruction: InstructionInspection; + onNavigate: (address: string) => void; + busy: boolean; +}) { const incoming = instruction.incomingReferences; return (
@@ -189,7 +193,9 @@ function InstructionView({ instruction }: { instruction: InstructionInspection } {incoming?.length === 0 &&

No incoming references reported.

} {incoming?.map((reference, index) => (
- {reference.sourceAddress ?? "unknown source"} + {reference.sourceAddress ? ( + + ) : "unknown source"} {reference.type} {reference.tags.join(" ยท ") || `operand ${reference.operandIndex}`}
@@ -787,7 +793,11 @@ export default function App() { {visibleStrings.map((entry) => (
{hex(entry.offset)} - {entry.value} + {entry.address ? ( + + ) : entry.value}
))} {visibleStrings.length === 0 &&

No matching strings.

} @@ -906,7 +916,7 @@ export default function App() { )} {codeView === "instruction" ? ( - instruction ? :

No exact instruction inspection is loaded.

+ instruction ? :

No exact instruction inspection is loaded.

) : codeView === "references" ? ( dossier ? (
diff --git a/apps/desktop/src/renderer/src/styles.css b/apps/desktop/src/renderer/src/styles.css index 9d1a67f..5f43def 100644 --- a/apps/desktop/src/renderer/src/styles.css +++ b/apps/desktop/src/renderer/src/styles.css @@ -166,6 +166,7 @@ dt { color: #727b8a; } dd { margin: 0; text-align: right; font-family: ui-monosp .strings-list { overflow: auto; } .string-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; padding: 7px 16px; border-bottom: 1px solid #181c23; font-size: 12px; } +.string-link { text-align: left; overflow-wrap: anywhere; max-width: 100%; } .string-row code { color: #697386; } .string-row span { overflow-wrap: anywhere; color: #c4cad4; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; } .muted { color: #687180; padding: 16px; } diff --git a/docs/BZIP2RECOVER_WALKTHROUGH.md b/docs/BZIP2RECOVER_WALKTHROUGH.md index 4dc1deb..0db5d6e 100644 --- a/docs/BZIP2RECOVER_WALKTHROUGH.md +++ b/docs/BZIP2RECOVER_WALKTHROUGH.md @@ -15,13 +15,11 @@ Use **Open binary** and check the SHA-256 in the target panel. The string search ## Follow the evidence 1. In **Printable strings**, filter for `can't read`. The match at file offset `0x8D74` includes placeholders for the program and input names. The string alone does not tell you when it is printed. -2. Click **Analyze with Ghidra**. The navigation box accepts virtual addresses. For this build the image base is `0x140000000`. The string is `0x174` bytes into the raw data of the `.rdata` section (file start `0x8C00`, section RVA `0xB000`). Its loaded address is therefore `0x14000B174`. -3. Enter that address in the navigation box and press Enter. In **Instruction**, Ghidra classifies the location as data. Under **Incoming references** it reports one source, `0x140009399`. Enter that source address in the same box to move from the text to its use. +2. Click **Analyze with Ghidra**. In alpha.2 or later, click the matching string to inspect its loaded address directly. In alpha.1, use the manual calculation below. The navigation box accepts virtual addresses. For this build the image base is `0x140000000`. The string is `0x174` bytes into the raw data of the `.rdata` section (file start `0x8C00`, section RVA `0xB000`). Its loaded address is therefore `0x14000B174`. +3. If using alpha.1, enter that address in the navigation box and press Enter. In **Instruction**, Ghidra classifies the location as data. Under **Incoming references** it reports one source, `0x140009399`. Click that source address to move from the text to its use. In alpha.1, enter it in the navigation box instead. 4. Open **Pseudocode** for the containing function, `FUN_140008b00`. Find the first call that opens the input in `rb` mode. The null-result branch formats the error with the input filename and calls `exit(1)`. Another open later in the same function has a different error message. 5. Give the function an analyst alias such as `recover_main`, record your finding in **Comment**, and choose **Save project**. The project records the alias against function address `0x140008b00` and identifies the target by SHA-256. ## Check the interpretation In the bzip2 1.0.8 source, the corresponding code is in `main`. It sends the message to standard error and exits with status 1 when the first read-only open returns null. A missing file is one way to reach the branch. This evidence does not distinguish it from a permission failure. Ghidra leaves the formatted-output helper unnamed in this build; the source identifies the original operation as `fprintf`. [Compare bzip2recover.c](https://sources.debian.org/src/bzip2/1.0.8-5/bzip2recover.c/) - -This case exposed two extra manual steps: converting a string's file offset to a loaded address and re-entering the source address of an incoming reference. Both are opportunities to shorten the investigation without hiding the underlying addresses. diff --git a/package-lock.json b/package-lock.json index 8e5a121..14a6d59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hexscry", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hexscry", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "license": "MPL-2.0", "workspaces": [ "apps/*", @@ -21,7 +21,7 @@ }, "apps/desktop": { "name": "@hexscry/desktop", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "license": "MPL-2.0", "dependencies": { "@electron-toolkit/utils": "^4.0.0", @@ -8744,7 +8744,7 @@ }, "packages/core": { "name": "@hexscry/core", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "license": "MPL-2.0", "devDependencies": { "@types/node": "^24.0.0", @@ -8754,7 +8754,7 @@ }, "packages/plugin-sdk": { "name": "@hexscry/plugin-sdk", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "license": "MPL-2.0", "dependencies": { "@hexscry/core": "*" @@ -8766,7 +8766,7 @@ }, "packages/provider-rea": { "name": "@hexscry/provider-rea", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "license": "MPL-2.0", "dependencies": { "@hexscry/core": "*", diff --git a/package.json b/package.json index 9060616..47b24a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexscry", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "private": true, "description": "Open-source reverse engineering workbench for evidence-first human and AI-assisted analysis.", "license": "MPL-2.0", diff --git a/packages/core/package.json b/packages/core/package.json index 3a18e3c..1bc4880 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@hexscry/core", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "private": true, "license": "MPL-2.0", "type": "module", diff --git a/packages/core/src/model.ts b/packages/core/src/model.ts index e4ea4e8..ea4d624 100644 --- a/packages/core/src/model.ts +++ b/packages/core/src/model.ts @@ -10,6 +10,7 @@ export interface SectionInfo { } export interface ExtractedString { + address?: string; offset: number; value: string; } diff --git a/packages/core/src/pe.ts b/packages/core/src/pe.ts index 719161b..10476d5 100644 --- a/packages/core/src/pe.ts +++ b/packages/core/src/pe.ts @@ -865,6 +865,22 @@ export function parsePortableExecutable(path: string, buffer: Buffer): BinaryRep const debugResult = parseDebugDirectory(buffer, format, optional, optionalSize, sections, sizeOfHeaders); const tlsResult = parseTlsDirectory(buffer, format, optional, optionalSize, sections, sizeOfHeaders, imageBaseValue); const strings = extractAsciiStrings(buffer); + // Windows images support up to 96 sections. Keep malformed inputs cheap and + // only offer a jump when the entire string fits one file-backed section. + if (sections.length <= 96) { + for (const entry of strings) { + const matches = sections.filter((section) => { + const delta = entry.offset - section.rawOffset; + const mappedSize = Math.min(section.rawSize, section.virtualSize || section.rawSize); + return delta >= 0 && delta + entry.value.length <= mappedSize; + }); + const section = matches[0]; + if (section && matches.length === 1) { + const rva = section.virtualAddress + (entry.offset - section.rawOffset); + entry.address = `0x${(imageBaseValue + BigInt(rva)).toString(16)}`; + } + } + } const limitations: string[] = [ ...importResult.limitations, ...exportResult.limitations, diff --git a/packages/core/test/fixture.test.ts b/packages/core/test/fixture.test.ts index 1867527..40624e8 100644 --- a/packages/core/test/fixture.test.ts +++ b/packages/core/test/fixture.test.ts @@ -16,7 +16,8 @@ test("parses the deterministic x64 PE corpus fixture", async () => { assert.equal(report.fileSize, 0x400); assert.equal(report.sha256, "134f2ecaa3e88b87d42e8ee146b9ad40ac0e985c576b028ceea2df7d5dbc139e"); assert.deepEqual(report.sections.map((section) => section.name), [".text"]); - assert.ok(report.strings.some((entry) => entry.value === "HexScry deterministic PE fixture")); + assert.equal(report.strings.find((entry) => entry.value === "HexScry deterministic PE fixture")?.address, "0x140001020"); + assert.equal(report.strings.find((entry) => entry.value === ".text")?.address, undefined); const entry = await readBinaryWindowAtAddress(report, "0x140001000", 3); assert.equal(entry.fileOffset, 0x200); diff --git a/packages/plugin-sdk/package.json b/packages/plugin-sdk/package.json index fba3975..ca0a106 100644 --- a/packages/plugin-sdk/package.json +++ b/packages/plugin-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@hexscry/plugin-sdk", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "private": true, "license": "MPL-2.0", "type": "module", diff --git a/packages/provider-rea/package.json b/packages/provider-rea/package.json index a4bec49..2d933c1 100644 --- a/packages/provider-rea/package.json +++ b/packages/provider-rea/package.json @@ -1,6 +1,6 @@ { "name": "@hexscry/provider-rea", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "private": true, "license": "MPL-2.0", "type": "module",