NationalSecurityAgency/ghidra · error · LSHException

Read bad library placeholder md5 for ExecutableRecord

Error message

Read bad library placeholder md5 for ExecutableRecord

What it means

Thrown during ExecutableRecord.restoreXml when the XML declares a library ('islib') entry: after creating the library via man.newExecutableLibrary(name_exec, architecture, id), the loader recomputes the library md5 placeholder and compares it to the md5sum read from the XML. A mismatch means the XML's md5 is inconsistent with the (name, architecture) it claims, indicating a corrupt or tampered document.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/description/ExecutableRecord.java:669

				else if (nm.equals("repository")) {
					repo = parser.end().getText();
				}
				else if (nm.equals("path")) {
					path = parser.end().getText();
				}
				else {
					parser.end();
				}
			}
		}

		parser.end(el);
		ExecutableRecord res;

		if (islib) {
			res = man.newExecutableLibrary(name_exec, architecture, id);
			if ((!res.getMd5().equals(md5sum))) {
				throw new LSHException("Read bad library placeholder md5 for ExecutableRecord");
			}
		}
		else {
			final long date_milli = seconds * 1000 + millis;
			res = man.newExecutableRecord(md5sum, name_exec, name_compiler, architecture,
				new Date(date_milli), repo, path, id);
		}
		res.setCategory(cats);
		return res;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		if (this == obj) {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Re-export the BSim data from a trusted source so the library md5 placeholder matches name+architecture.
  2. Recompute and correct the md5sum attribute to equal calcLibraryMd5Placeholder(name, architecture) if you control the document.
  3. Validate the document against the expected BSim XML schema before restoreXml.
Defensive patterns

Strategy: validation

Try / catch

try {
    ExecutableRecord.restoreXml(parser, man);
} catch (LSHException e) {
    if (e.getMessage().contains("bad library placeholder md5")) {
        // re-export the document from a trusted source
    } else throw e;
}

Prevention

When it happens

Trigger: restoreXml parsing a library 'exe' element whose md5sum attribute does not equal calcLibraryMd5Placeholder(name_exec, architecture) for the parsed name/architecture. Caused by hand-edited or truncated BSim XML, or by a writer that did not use the placeholder scheme.

Common situations: Manually edited XML; data exported by a third-party/incompatible tool; name or architecture fields altered after the md5 was written; partial file corruption.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/8b278250821491d9. Report an issue: GitHub.