222 Commits

Author SHA1 Message Date
Koh M. Nakagawa
1a7f8c41eb fix to avoid SIGSEGV 2020-06-01 22:34:31 +09:00
Koh M. Nakagawa
38f48a6e12 fix wrong EnumToString 2020-05-28 06:26:29 +02:00
rthomas
5684960317 Update dependencies 2020-05-24 06:47:15 +02:00
rthomas
3cee05646c Fix typo 2020-05-20 16:30:38 +02:00
Koh M. Nakagawa
cd05f34bae add IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS 2020-05-11 09:16:59 +02:00
rthomas
a04eb8888a Enhancement 2020-05-03 11:15:36 +02:00
thetufik
2c85678fb6 feature: release the GIL on parse 2020-04-21 16:54:23 +03:00
Romain
a26ae60e83
Merge pull request #365 from mingwandroid/FixMissing-typeinfo-symbol
Export BuildToolVersion and fix typo
2019-12-11 07:46:31 +01:00
Ray Donnelly
68f6154722 Fix typo BuildeVersion => BuildVersion which may lead to my link failures 2019-12-10 15:42:04 +01:00
Romain Thomas
eeddc38393 Handle PE forwarded exports
Resolve: #307
2019-12-10 06:33:48 +01:00
rthomas
0ade59de75 Add PT_GNU_PROPERTY 2019-12-06 06:22:01 +01:00
rthomas
86a35bd7bc Fix typo 2019-11-28 17:16:57 +01:00
rthomas
b0e480c9f2 Fix Python parsing with input 'bytes' 2019-11-28 07:53:27 +01:00
rthomas
ca4e6148fe Add API to demangle strings 2019-11-28 16:25:58 +01:00
rthomas
934d84ffea Move to Pybind11 v2.4.3 and fix enum conflicts 2019-11-19 06:41:11 +01:00
Andrew
08d31be932 Authenticode-related bug fixes and improvements
Part of Authenticode verification consists of:
 - Comparing the computed Authenticode hash to the digest
   stored in the ContentInfo section
 - Comparing hash(ContentInfo) to the digest stored in the
   AuthenticatedAttributes section
 - Verifying signed(hash(AuthenticatedAttributes)) using a
   certificate identified by the issuer and serial number
   specified in the SignerInfo section

This commit makes it so that the raw bytes needed to
calculate hash(ContentInfo) and hash(AuthenticatedAttributes)
are available for use.

============================================================

Allow missing [0] in SpcSpOpusInfo

Some executables have MoreInfo but not a ProgramName (and the documentation
lists both as OPTIONAL), so handle this case correctly.

Example:

```
01416b1730218454c99b13592650cb170402b86742b4bab971565903b841829b

SEQUENCE(2 elem)
OBJECT IDENTIFIER1.3.6.1.4.1.311.2.1.12spcSpOpusInfo(Microsoft code signing)
SET(1 elem)
  SEQUENCE(1 elem)
  [1](1 elem)
   [0]http://www.mozilla.com
```

============================================================

Improve consistency of parsed serial numbers

When parsing the issuer serial number, call mbedtls_x509_get_serial instead of
parsing it as an integer directly with mbedtls_asn1_get_mpi. These two functions
differ in how they treat serial numbers prepended with '00' to prevent them from
being negative (the former preserves the '00', and the latter discards it). The
embedded certs are parsed via a call to mbedtls_x509_crt_parse_der, which uses
mbedtls_x509_get_serial behind the scenes, so there was an inconsistency between
lief_obj.signature.signer_info.issuer[1] and
lief_obj.signature.certificates[x].serial_number.  Example:

8bf57d97dd917c4f823659266caaa33e7398406daf11ba8318e3f7414ee3fb24

============================================================

Handle SpcLink and SpcString CHOICEs in SpcSpOpusInfo

The Authenticode spec doc says that these can be CHOICES, so
handle the easy ones and safely skip the others.

============================================================

Allow Authenticode sig to be parsed even if cert parsing fails

By default, mbedtls doesn't support MD2 certs, which are fairly
common in older signed executables.  Ex:

1cb16f94cebdcad7dd05c8537375a6ff6379fcdb08528fc83889f26efaa84e2a

============================================================

Enable mbed TLS MD2 and MD4 support; add Unix debug options

By default, mbedtls doesn't support MD2 certs, which are fairly
common in older signed executables.  Ex:

1cb16f94cebdcad7dd05c8537375a6ff6379fcdb08528fc83889f26efaa84e2a

============================================================

Set MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION flag

Some older signed executables use certs with the SpcSpAgencyInfo
Critical Extension, which mbed TLS doesn't support, so set
MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION to have it
skip this extension.  Example:

781ca31416ec708a587851dafd90c661b86f244ab8b8475c4185e958e54ff838

============================================================

Support accessing non-utf8 issuer names via Python

For a few signatures where the issuer name contained non-utf8
characters, accessing the issuer name field in Python would raise
a UnicodeDecodeError exception. Now this field is handled the
same way the names in the individual certs are (I'm not sure if
they get represented 100% correctly, but at least they are
consistent, which is good enough for me). Example:

048f91b9302c88380fc66adac1e314d82733089ef3a31eadca5f0cb4169b195f
2019-10-07 00:58:40 -04:00
rthomas
208264cb66 Remove unused files
Resolve #348
2019-10-02 08:13:12 +02:00
Andrew Williams
fcb9c76be6 Expose the raw bytes backing each PE Authenticode cert (#320) 2019-07-26 19:26:13 +02:00
Romain Thomas
bd9be9a765 Add notice regarding LIEF imphash implementation
Related to #299
2019-06-26 09:10:35 +02:00
Romain Thomas
778763de88 Fix Python return value policy for `get_symbol()`
Resolve #305
2019-06-23 10:19:14 +02:00
Romain Thomas
fa3195b1bd Add API to check if a section associated with an Off/VA exists 2019-05-28 09:47:33 +02:00
Romain Thomas
36a7eeda2a Fix #292 2019-05-03 20:40:13 +02:00
Cédric Tessier
9fc3a8a433 Add coredump support in LIEF 2019-04-18 07:17:46 +02:00
Romain Thomas
0d03b4bdb8 Improve Python setup 2019-03-31 10:15:08 +02:00
Romain Thomas
b26abae9a9 Fix #285 2019-03-25 20:38:28 +01:00
Romain Thomas
a2403d5eeb Resolve #280 2019-03-14 12:48:03 +01:00
Romain Thomas
90867193b5 Fix #271 2019-03-10 17:49:21 +01:00
Romain Thomas
7e88e2b2c0 Add function to check if a symbol can be removed 2019-02-18 14:17:08 +01:00
Romain Thomas
826aae615b Add function to check format integrity against codesign 2019-02-18 14:17:08 +01:00
Romain Thomas
616d739da5 Enable to remove Mach-O symbols 2019-02-18 14:17:08 +01:00
KOLANICH
8a30e1a3d7 Added a dir with runtime libs i to PATH if it exists 2019-01-27 08:55:14 +01:00
dm
3833e0be9c Add min_size parameters to Binary::strings function 2019-01-15 07:41:50 +01:00
Romain Thomas
8d7ec26a93 Add ELF ABI Version 2018-12-30 20:27:53 +01:00
Romain Thomas
c1758ba1ed Fix 249 2018-12-24 05:33:11 +01:00
Samuel Albrecht
e64668c0c8 chg: recognize cygwin in setup.py 2018-12-18 07:42:26 +00:00
Romain Thomas
3b892188a1 Fix typo 2018-12-16 19:24:20 +01:00
Romain Thomas
678039cf44 Add missing enum 2018-12-16 17:57:57 +01:00
1orenz0
3537440b8d Add support to parse POGO debug entries 2018-12-16 16:34:12 +01:00
Romain Thomas
6f967238fc Introduce Mach-O Build Version command
New API:
  LIEF::MachO::BuildVersion
  LIEF::MachO::BuildToolVersion

  LIEF::MachO::Binary::has_build_version
  LIEF::MachO::Binary::build_version
2018-12-13 15:37:19 +01:00
Romain Thomas
35b3d039f7 Only relocate section if the original one was not empty.
We also introduce ELF API for overlay:
  * lief.ELF.Binary.eof_offset
  * lief.ELF.Binary.has_overlay
  * lief.ELF.Binary.overlay
2018-12-13 09:32:54 +01:00
1orenz0
fcc75dd879 Parse PE debug data directory as a list of debug entries
PE's DATA_DIRECTORY_DEBUG does not define a single debug entry, but
a list of struct pe_debug entries (the number of entries is determined
by the data directory's size).

This commit reflect this layout by returning a vector<> when calling
PE.debug()
2018-11-29 09:16:34 +01:00
Romain Thomas
184074841b Drop Python 2.7 support. Add Python 3.7 support 2018-11-16 11:00:09 +01:00
Hilko Bengen
cbacbc47f4 api/c: Add explict size fields for extracted content fields
Corrupted files may cause section or segment contents not to be
available entirely. However, C-based client code is not able to detect
this which may cause out-of-bounds reads when accessing data from the
.content fields.

Note: This is a silent ABI-breaking change because it changes struct layouts.

Note: Naming is inconsistent: .size was already taken in PE Sections.
2018-09-13 13:56:48 +02:00
Romain Thomas
b5a08463ad Expose API to list functions found in a binary 2018-09-12 14:44:18 +02:00
Adrien Guinet
89d4de54c8 Fix git tag commmand to always work
Forward CRT on other targets
2018-08-29 13:38:27 +02:00
Adrien Guinet
4b03ac45e0 Remove LIEF_SHARED_LIB from cmake
Moreover, add macros to force the CRT usage when using MSVC.
This is based on the LLVM one.
2018-08-29 08:50:56 +02:00
Romain Thomas
d394e0e58f Strip file for Release Build 2018-08-20 09:04:28 +02:00
Romain Thomas
bce9ebe170 Add support for Android 9 2018-08-10 16:10:51 +02:00
Romain Thomas
04dddd3710 Fix alignment issue when removing a PE section 2018-08-10 15:16:29 +02:00
Romain Thomas
02f4851c9f Return string located in the .rodata section
New API: lief.ELF.Binary.strings / LIEF::ELF::Binary::strings()
2018-07-27 10:56:41 +02:00