Repository navigation
Conversation
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS This record compares head Five campaign samples raise
The other 482 campaign-recorded Mach-O objects have the same outcome and An earlier record covered a separate group of six universal Mach-O libraries.
|
|
Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_776 |
Every other placement in _map_object asks the address space first. The position-independent main binary does not: it takes 0x400000 unconditionally, which is right while it is the only object being placed and wrong as soon as it is not. A container backend loads its children through the loader, and a child can come out marked as the main binary. Universal2 marks every slice it loads, because a Mach-O executable refuses to load as anything else. The slices of a universal Mach-O therefore all asked for 0x400000, the first one got the backer, and the rest failed with "Address 0x400000 is already backed!". Six universal Mach-O libraries in a corpus sweep failed to load this way. Ask _is_range_free first and fall back to the ordinary rebase search, so the main binary keeps its conventional base whenever that base is available. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
6f08fcb to
3443309
Compare
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS These public fixtures show two forms of the same collision. One loads two child Reproducerimport logging, os
logging.getLogger("cle").setLevel(logging.CRITICAL)
import cle
BIN = os.environ["BINARIES"] # a checkout of angr/binaries
T = lambda *p: os.path.join(BIN, "tests", *p)
path = T("multi_arch", "fauxware_macho_multiarch")
ld = cle.Loader(path, auto_load_libs=False)
for o in ld.all_objects:
print(f"{type(o).__name__:<12} {o.min_addr:#x}-{o.max_addr:#x} is_main_bin={o.is_main_bin}")
print("--- two container children both marked as the main binary")
class Mock(cle.backends.Backend):
def __init__(self, size, **kw):
super().__init__("/dev/zero", None, **kw)
self.size = size
self.pic = True
self.has_memory = False
@property
def max_addr(self):
return self.mapped_base + self.size - 1
ld2 = cle.Loader(T("i386", "manysum"), auto_load_libs=False)
first = Mock(0x1000, arch=ld2.main_object.arch, is_main_bin=True)
second = Mock(0x1000, arch=ld2.main_object.arch, is_main_bin=True)
ld2.dynamic_load(first)
print(f" first {first.min_addr:#x}-{first.max_addr:#x}")
try:
ld2.dynamic_load(second)
print(f" second {second.min_addr:#x}-{second.max_addr:#x}"
f"{' ON TOP OF THE FIRST' if second.min_addr <= first.max_addr else ''}")
except Exception: # noqa: BLE001
print(" second: EXCEPTION: " + traceback.format_exc().strip().splitlines()[-1])BeforeAt AfterAt |
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Problem
cle.Loadercan assign the occupied conventional base to a secondmain-marked position-independent object. Memory insertion then raises
ValueError: Address 0x400000 is already backed!.A container backend loads its children through the loader. In a main Universal2
load, the selected Mach-O slices are marked as main binaries. Two main-marked
child objects loaded beside
binaries/tests/i386/manysumshow the collision:On
binaries/tests/multi_arch/fauxware_macho_multiarch, the i386 slice alsolands on the container object:
Cause
_map_objectchecks whether custom and linked ranges are free. It does notcheck the range before assigning
0x400000to another main-markedposition-independent object:
Fix
Check whether
0x400000is free before using it. If it is occupied, use theexisting safe-rebase search. A lone main object still receives the conventional
base when it has no custom or nonzero linked base.
Affected samples
The campaign record identifies five affected samples:
19be29f38a574b5b1448a6256f2cec0f2ed850c750792dd46a57fa4a37b8e4ea— The sample cannot be shared.1a74eab65c67676a4584c7316929054cc861bc6dbad65ebb9d8f530e9da9e3a8— The sample cannot be shared.24e042930c58dbc0c832f896b2569fa6e2160bd86cb877d2d476621fa9159577— The sample cannot be shared.7389f21dcf8406ea78817e5ed47985b2eeff59beb92e617879cbd90febb2f13e— The sample cannot be shared.751e8656af24f4a5af5614167071c326df333c4046466573e9b34d61eb715908— The sample cannot be shared.Campaign commands
#674 would limit the default universal load to one slice. It would hide this
case without fixing the unchecked placement.
Campaign record: #776 (comment)