From 98838bd99ab4f9b67b48c57204cbc8c58919ed95 Mon Sep 17 00:00:00 2001 From: Aryan Rajoria Date: Tue, 8 Oct 2024 15:54:14 +0530 Subject: [PATCH 1/6] fix Signed-off-by: Aryan Rajoria --- blint/binary.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blint/binary.py b/blint/binary.py index 20c64a0..0dbcf87 100644 --- a/blint/binary.py +++ b/blint/binary.py @@ -907,7 +907,8 @@ def add_elf_dynamic_entries(dynamic_entries, metadata): if isinstance(dynamic_entries, lief.lief_errors): return metadata for entry in dynamic_entries: - if entry.tag == lief.ELF.DynamicEntry.TAG.NULL: + # if entry.tag == lief.ELF.DynamicEntry.TAG.NULL: + if not hasattr(entry, 'name'): continue if entry.tag in [ lief.ELF.DynamicEntry.TAG.SONAME, From c6226dc0185a12c913c9117dbb04092d24a44203 Mon Sep 17 00:00:00 2001 From: Aryan Rajoria Date: Tue, 8 Oct 2024 16:07:19 +0530 Subject: [PATCH 2/6] remove comment Signed-off-by: Aryan Rajoria --- blint/binary.py | 1 - 1 file changed, 1 deletion(-) diff --git a/blint/binary.py b/blint/binary.py index 0dbcf87..868751a 100644 --- a/blint/binary.py +++ b/blint/binary.py @@ -907,7 +907,6 @@ def add_elf_dynamic_entries(dynamic_entries, metadata): if isinstance(dynamic_entries, lief.lief_errors): return metadata for entry in dynamic_entries: - # if entry.tag == lief.ELF.DynamicEntry.TAG.NULL: if not hasattr(entry, 'name'): continue if entry.tag in [ From f5ff4de92caaf7df479abb13492600d22dfba7e7 Mon Sep 17 00:00:00 2001 From: Aryan Rajoria Date: Tue, 8 Oct 2024 16:23:07 +0530 Subject: [PATCH 3/6] add suggested changes Signed-off-by: Aryan Rajoria --- blint/binary.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/blint/binary.py b/blint/binary.py index 868751a..dec2a74 100644 --- a/blint/binary.py +++ b/blint/binary.py @@ -907,7 +907,7 @@ def add_elf_dynamic_entries(dynamic_entries, metadata): if isinstance(dynamic_entries, lief.lief_errors): return metadata for entry in dynamic_entries: - if not hasattr(entry, 'name'): + if entry.tag == lief.ELF.DynamicEntry.TAG.NULL: continue if entry.tag in [ lief.ELF.DynamicEntry.TAG.SONAME, @@ -915,16 +915,24 @@ def add_elf_dynamic_entries(dynamic_entries, metadata): lief.ELF.DynamicEntry.TAG.RUNPATH, lief.ELF.DynamicEntry.TAG.RPATH, ]: - metadata["dynamic_entries"].append( - { - "name": demangle_symbolic_name(entry.name), - "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], - "value": entry.value, - } - ) - # Detect dotnet binary - if "netcoredeps" in entry.name: - metadata["exe_type"] = "dotnetbinary" + if hasattr(entry, 'name'): + metadata["dynamic_entries"].append( + { + "name": demangle_symbolic_name(entry.name), + "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], + "value": entry.value, + } + ) + if "netcoredeps" in entry.name: + metadata["exe_type"] = "dotnetbinary" + elif hasattr(entry, 'runpath'): + metadata["dynamic_entries"].append( + { + "runpath": demangle_symbolic_name(entry.runpath), + "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], + "value": entry.value, + } + ) return metadata From 7bcc8e3ae0bf1e4f971a46919ac51b7f4d4fdd00 Mon Sep 17 00:00:00 2001 From: Aryan Rajoria Date: Thu, 10 Oct 2024 15:15:39 +0530 Subject: [PATCH 4/6] fix: add suggested changes Signed-off-by: Aryan Rajoria --- blint/binary.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/blint/binary.py b/blint/binary.py index dec2a74..f78a092 100644 --- a/blint/binary.py +++ b/blint/binary.py @@ -912,27 +912,27 @@ def add_elf_dynamic_entries(dynamic_entries, metadata): if entry.tag in [ lief.ELF.DynamicEntry.TAG.SONAME, lief.ELF.DynamicEntry.TAG.NEEDED, - lief.ELF.DynamicEntry.TAG.RUNPATH, lief.ELF.DynamicEntry.TAG.RPATH, ]: - if hasattr(entry, 'name'): - metadata["dynamic_entries"].append( - { - "name": demangle_symbolic_name(entry.name), - "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], - "value": entry.value, - } - ) - if "netcoredeps" in entry.name: - metadata["exe_type"] = "dotnetbinary" - elif hasattr(entry, 'runpath'): - metadata["dynamic_entries"].append( - { - "runpath": demangle_symbolic_name(entry.runpath), - "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], - "value": entry.value, - } - ) + metadata["dynamic_entries"].append( + { + "name": demangle_symbolic_name(entry.name), + "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], + "value": entry.value, + } + ) + if "netcoredeps" in entry.name: + metadata["exe_type"] = "dotnetbinary" + if entry.tag in [ + lief.ELF.DynamicEntry.TAG.RUNPATH, + ]: + metadata["dynamic_entries"].append( + { + "runpath": demangle_symbolic_name(entry.runpath), + "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], + "value": entry.value, + } + ) return metadata From cbb762d62d8bd3ad7b1d39c3022abd4412402804 Mon Sep 17 00:00:00 2001 From: Aryan Rajoria Date: Thu, 10 Oct 2024 15:59:23 +0530 Subject: [PATCH 5/6] seperate RPATH Signed-off-by: Aryan Rajoria --- blint/binary.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/blint/binary.py b/blint/binary.py index f78a092..b841452 100644 --- a/blint/binary.py +++ b/blint/binary.py @@ -912,7 +912,6 @@ def add_elf_dynamic_entries(dynamic_entries, metadata): if entry.tag in [ lief.ELF.DynamicEntry.TAG.SONAME, lief.ELF.DynamicEntry.TAG.NEEDED, - lief.ELF.DynamicEntry.TAG.RPATH, ]: metadata["dynamic_entries"].append( { @@ -928,9 +927,19 @@ def add_elf_dynamic_entries(dynamic_entries, metadata): ]: metadata["dynamic_entries"].append( { - "runpath": demangle_symbolic_name(entry.runpath), + "name": "runpath", "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], - "value": entry.value, + "value": entry.runpath, + } + ) + if entry.tag in [ + lief.ELF.DynamicEntry.TAG.RPATH, + ]: + metadata["dynamic_entries"].append( + { + "name": "rpath", + "tag": str(entry.tag).rsplit(".", maxsplit=1)[-1], + "value": entry.rpath, } ) return metadata From 6da765d4ea5210fe8223b42355d7d20a530cfb33 Mon Sep 17 00:00:00 2001 From: Aryan Rajoria Date: Thu, 10 Oct 2024 16:05:05 +0530 Subject: [PATCH 6/6] bump version 2.2.3 --- Info.plist | 2 +- file_version_info.txt | 4 ++-- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Info.plist b/Info.plist index 4ee5063..9659005 100644 --- a/Info.plist +++ b/Info.plist @@ -9,6 +9,6 @@ CFBundleName blint CFBundleVersion - 2.2.2 + 2.2.3 diff --git a/file_version_info.txt b/file_version_info.txt index c1f458a..01530fb 100644 --- a/file_version_info.txt +++ b/file_version_info.txt @@ -32,12 +32,12 @@ VSVersionInfo( u'040904B0', [StringStruct(u'CompanyName', u'OWASP Foundation'), StringStruct(u'FileDescription', u'blint - The Binary Linter'), - StringStruct(u'FileVersion', u'2.2.2.0'), + StringStruct(u'FileVersion', u'2.2.3.0'), StringStruct(u'InternalName', u'blint'), StringStruct(u'LegalCopyright', u'© OWASP Foundation. All rights reserved.'), StringStruct(u'OriginalFilename', u'blint.exe'), StringStruct(u'ProductName', u'blint'), - StringStruct(u'ProductVersion', u'2.2.2.0')]) + StringStruct(u'ProductVersion', u'2.2.3.0')]) ]), VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) ] diff --git a/pyproject.toml b/pyproject.toml index 8fb24ba..f54f9c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "blint" -version = "2.2.2" +version = "2.2.3" description = "Linter and SBOM generator for binary files." authors = ["Prabhu Subramanian ", "Caroline Russell "] license = "MIT"