Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 14 additions & 4 deletions apps/desktop/src/renderer/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="instruction-view">
Expand Down Expand Up @@ -189,7 +193,9 @@ function InstructionView({ instruction }: { instruction: InstructionInspection }
{incoming?.length === 0 && <p className="muted">No incoming references reported.</p>}
{incoming?.map((reference, index) => (
<div className="instruction-ref" key={`in-${reference.sourceAddress ?? "unknown"}-${index}`}>
<code>{reference.sourceAddress ?? "unknown source"}</code>
<code>{reference.sourceAddress ? (
<button className="evidence-link" disabled={busy} onClick={() => onNavigate(reference.sourceAddress!)}>{reference.sourceAddress}</button>
) : "unknown source"}</code>
<span>{reference.type}</span>
<small>{reference.tags.join(" · ") || `operand ${reference.operandIndex}`}</small>
</div>
Expand Down Expand Up @@ -787,7 +793,11 @@ export default function App() {
{visibleStrings.map((entry) => (
<div className="string-row" key={`${entry.offset}-${entry.value}`}>
<code>{hex(entry.offset)}</code>
<span>{entry.value}</span>
<span>{entry.address ? (
<button className="evidence-link string-link" disabled={procedures.length === 0 || navBusy}
title={procedures.length ? `Inspect string at ${entry.address}` : "Run deep analysis to inspect string references."}
onClick={() => void navigateEvidenceAddress(entry.address!)}>{entry.value}</button>
) : entry.value}</span>
</div>
))}
{visibleStrings.length === 0 && <p className="muted">No matching strings.</p>}
Expand Down Expand Up @@ -906,7 +916,7 @@ export default function App() {
)}

{codeView === "instruction" ? (
instruction ? <InstructionView instruction={instruction} /> : <p className="muted">No exact instruction inspection is loaded.</p>
instruction ? <InstructionView instruction={instruction} onNavigate={navigateEvidenceAddress} busy={navBusy} /> : <p className="muted">No exact instruction inspection is loaded.</p>
) : codeView === "references" ? (
dossier ? (
<div className="xref-view">
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
6 changes: 2 additions & 4 deletions docs/BZIP2RECOVER_WALKTHROUGH.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface SectionInfo {
}

export interface ExtractedString {
address?: string;
offset: number;
value: string;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/core/src/pe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/core/test/fixture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-sdk/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/provider-rea/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Loading