Commit graph

28491 commits

Author SHA1 Message Date
Anton Kochkov
9c1b88903e
Remove typelink remnants (#3638) 2023-07-04 19:57:49 +08:00
Riccardo Schirone
194eabae1c
Fix /wi by removing wrong fallthrough (#3636)
/wi was falling through the switch case and it was not accepting the
input correctly. Fix this by breaking at the end of the '/w' case so
that the search can begin.
2023-07-04 17:09:28 +08:00
Anton Kochkov
1f30b7f761
Remove typelink remnants (#3635) 2023-07-04 10:54:32 +08:00
Giovanni
8efdb3d3a3
Refactoring debug plugin and cleanup output (#3634) 2023-07-04 10:42:41 +08:00
Anton Kochkov
8c1ce710e1
Remove type links and use global vars (#3618) 2023-07-03 02:02:12 +08:00
Giovanni
366dfcfbf0
Limit aap scan like we do for strings. (#3620) 2023-07-02 01:14:12 +08:00
Florian Märkl
54640cb01c Fix rz_buf_read_at() after negative addr
rz_buf_read_at() with a negative addr on a ref (slice) buffer broke all
subsequent calls to rz_buf_read_at(). This is fixed by making sure to
always reset to the initial seek.
This bug was detected through xnu kernelcaches, where we may also skip
any obviously invalid read.
2023-07-01 22:28:28 +08:00
Florian Märkl
1d39c16840 Support IDREF in plist parser
IDREF in plists is an undocumented extension of plist used e.g. in
kernelcaches. This makes it possible to parse certain kext plists.

Backported, original patch b04bc4164cb2875723f3aae870647287e9a331cc

Co-authored-by: Siguza <siguza@siguza.net>
2023-07-01 22:28:28 +08:00
Florian Märkl
6b2d6fed9a Fix naming convention in plist parser 2023-07-01 22:28:28 +08:00
Florian Märkl
8dc8fdd71f Fix some oob reads in xnu kernelcache
A __DATA_CONST.__const section of e.g. size 1 could make these loops
read beyond the end of the allocated buffer.
2023-06-30 18:04:31 +02:00
Florian Märkl
bc9daaabbd Re-add ios syscall files
Initially removed in 4fd9cd7cc1, but may
still be used when loading xnu kernelcaches.
2023-06-30 18:04:31 +02:00
Giovanni
5badfe10f6
Always search for preludes if is not x86. (#3615) 2023-06-30 13:20:37 +08:00
Giovanni
09ec12d607
Update libdemangle to 2c90eaa (#3614) 2023-06-29 13:53:22 +08:00
Florian Märkl
6b42ed1d6c Mach-O: Do not reconstruct arm64e chained relocs without BIND_OPCODE_THREADED
arm64e kernelcaches may have no BIND_OPCODE_THREADED but
__TEXT$__thread_starts instead, which should then be used, meaning
MACH0_(has_chained_fixups)() has to return false such that this info
will be processed.
2023-06-28 17:33:46 +02:00
Florian Märkl
350dc181f5 Add xnu kernelcache support to rz_bin_language_detect() 2023-06-28 17:33:46 +02:00
Florian Märkl
e682143ec7 Fix double free in xnu_kernelcache when syscalls fail to load 2023-06-28 17:33:46 +02:00
Florian Märkl
b0f3a5f9ee
Refine MACH0_(imports_count)() (#3612)
For chained imports, we do not parse undefined symbols, so the upper
bound can be reduced there.
For non-chained imports, we can check for a definitely invalid value
using nsyms from LC_SYMTAB.
2023-06-28 13:49:54 +02:00
Heersin
c648b8ae10
Fix il vm aezi and aezs sync behavior (#3611) 2023-06-26 20:47:49 +08:00
zengwei2000
2239fa4402
Boolean value assigned to pointer (#3609) 2023-06-26 20:44:06 +08:00
Anton Kochkov
b5a936585a Rename analop to analysis_op and aop 2023-06-26 08:40:47 +08:00
Florian Märkl
ebe4263323 Implement chained fixups patching for binds
For bind chained fixups (pointing to imports parsed in the previous
commit) we reuse the patching code for classic relocs as the logic is
more generic here than for local chained fixups.
2023-06-25 19:39:56 +08:00
Florian Märkl
b6f984e445 Parse and use dyld chained fixup imports
The LC_DYLD_CHAINED_FIXUPS load command references a new kind of imports
table that is used for binding chained fixups. A similar table may be
reconstructed from the legacy BIND_OPCODE_THREADED info. We now display
these new imports in `ii` instead of the classic undefined symbols and
use them to assign names to relocs.

Objective-C superclass resolution for chained fixups is also changed to
first check for relocs and then for a non-zero address read from memory
instead of ignoring relocs entirely when there is a non-zero value in
memory (this did not work for chained fixups as those already have
non-zero values before patching).
2023-06-25 19:39:56 +08:00
Florian Märkl
f4796c5e66 Populate Mach-O relocs from chained fixups
Chained fixups are essentially a new kind of relocs, so it makes sense
to also represent them as RzBinRelocs. Currently the results are
sometimes less meaningful than the reloc info that was parsed before
from indirectsyms in such cases, as chained imports are not parsed yet
and thus the target symbols of bind relocs are not yet known, hence the
temporarily BROKEN tests.
2023-06-25 19:39:56 +08:00
Florian Märkl
27c7ced4b3 Combine Mach-O chained fixup info in single struct
More chained fixup information parsing will be implemented in the future
and added to this struct.
2023-06-25 19:39:56 +08:00
wargio
20965833d9 Ensure keyword is always non-null. 2023-06-25 18:16:24 +08:00
wargio
2c9a7008e9 Refactor analysis mips to remove static vars 2023-06-25 18:16:24 +08:00
Giovanni
d6779c42d7
Add len check in esil code before calling rz_analysis_op (#3603) 2023-06-25 13:44:02 +08:00
dvertx
8135a450e9
Refactor ls command for rzshell (#3600) 2023-06-24 20:49:12 +08:00
Florian Märkl
6452be6c20
Make rz-pipe tests invariant to local user config (#3601) 2023-06-23 18:19:45 +02:00
Florian Märkl
4fd9cd7cc1
Extend Mach-O platform recognition (#3599)
Some identical code from both mach-o 32 and 64 has been moved to
mach0_common.c to avoid duplicate compilation.
rz_mach0_platform_to_string() now recognizes all known platforms and the
information is shown as the subsys in the i command.
The "os" value was previously unreliably and ios sometimes showed as
"ios" and sometimes as "darwin" depending on the binary. Now the os is
"darwin" for all platforms. ios-* syscall files have thus been removed
as only darwin-* ones will be used.
2023-06-23 13:28:41 +00:00
Giovanni
6bfc67a286
Breaking method is user defined. (#3598) 2023-06-23 18:24:22 +08:00
Anton Kochkov
33c056e4e3
Add API to request function variables without arguments (#3597)
* Add Doxygen to variables API

* Add Doxygen to function API

* Improve arguments and variables API
2023-06-22 00:37:18 +08:00
dvertx
c9ef508bf4
Fix ls command parser (#3593) 2023-06-21 22:09:45 +08:00
Riccardo Schirone
8bc33bae5c
Remove unused rz-bb binary, probably left from r2 times (#3596) 2023-06-21 20:48:21 +08:00
Giovanni
9b6d9f86ac
Add reason when failing loading a windows dll (#3592) 2023-06-20 15:49:31 +08:00
Anton Kochkov
9c6feafd47
Prefer BE in strings search when it is known (#3588) 2023-06-19 13:19:50 +08:00
Anton Kochkov
f7a3309a29
Remove dead code in analysis/data (#3587) 2023-06-19 11:02:51 +08:00
swedenspy
655ea987cc
MD2 - hash implementation added according to RFC 1319 (#3585) 2023-06-18 23:01:57 +08:00
Giovanni
27dc5c8650
Remove old string detection methods. (#3584)
* Remove old string detection methods.
* Allow changing encoding based on `bin.str.enc`
* Cleanup for optimization regarding RzAnalysisData and its kind
* Allow changing endianness.
2023-06-18 18:12:59 +08:00
Giovanni
3ba4118615
Update blake3 commit (#3586) 2023-06-18 14:54:28 +08:00
borzacchiello
85f745e010
pyc: inizialize 'error' before calling 'magic_int_within' (#3583) 2023-06-17 08:29:47 +08:00
Anton Kochkov
3f18c11609
Update capstone project URL (#3580)
Co-authored-by: yossizap <yossizap@gmail.com>
2023-06-16 15:33:44 +08:00
billow
c1f92b3349
Fix rz_buf_uleb128 when parse 0xffffffffffffffffUL (#3579) 2023-06-16 09:27:42 +08:00
borzacchiello
d9a5cf3d28
Python 3.10 Support (#3577)
* Extract major and minor from python version string instead of converting it to double

The patch fixes 3.10 version extraction (3.10 == 3.1)

* update latest python magic version to 3491 in get_code_object

* opcodes for python3.10

* PYC: do not search for strings in code

* PYC python 3.10 tests

* Fixed typo in "pyc 3.9 sections" test

* pyc: refactored string search

* pyc: removed parse_version_major_minor

use "magic_int_within" to check python version
2023-06-16 08:28:17 +08:00
Dhruv Maroo
5f14d0e0b5 Fix analysis tests 2023-06-14 11:04:34 +08:00
Dhruv Maroo
2f6f2cfdce Fix ROR and update instruction asm tests 2023-06-14 11:04:34 +08:00
Dhruv Maroo
4127d7dabc Added CMOVcc, BSF, MOVABS, MOVSX, MOVSXD, MOVZX instructions 2023-06-14 11:04:34 +08:00
Dhruv Maroo
aa7781b098 Remove unnecessary local variable in IL for test instruction 2023-06-14 11:04:34 +08:00
Dhruv Maroo
5211e1835b Fix integration tests for x86 IL 2023-06-14 11:04:34 +08:00
Dhruv Maroo
0503f3a6fd Setters should set all the bytes of the register 2023-06-14 11:04:34 +08:00