Skip to content

Update: Reachability Plugin#426

Open
T0pAc3 wants to merge 26 commits into
llnl:mainfrom
T0pAc3:main
Open

Update: Reachability Plugin#426
T0pAc3 wants to merge 26 commits into
llnl:mainfrom
T0pAc3:main

Conversation

@T0pAc3

@T0pAc3 T0pAc3 commented Jun 13, 2025

Copy link
Copy Markdown
Collaborator

Summary

a plugin that finds the reachability of imported functions from exported functions

If merged this pull request will

Proposed changes

This is the 1.0 of the plugin. It returns a python dictionary of the imported functions reachable by the exported function of every binary.

@T0pAc3

T0pAc3 commented Jun 13, 2025

Copy link
Copy Markdown
Collaborator Author

Ok, now it should be working, thanks for being patient with all of the failed pull requests.

authors = [
{name = "Seth Bredbenner", email = "bredbenner1@llnl.gov"},
]
description = "Surfactant plugin for running grype on files"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description here needs updating

## Important Licensing Information
Main Project License (Surfactant): MIT License.

Plugin License: MIT License, but it includes and uses cve-bin-tool, which is GPL-3.0 licensed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cve-bin-tool line here does not apply to this plugin.

Comment on lines +11 to +15
After installing the plugin, run Surfactant to generate an SBOM as usual and entries for ELF
and PE files will contain a metadata object with the information that checksec.py was able
to get about security related features.

After the plugin installation, run Surfactant as you normally would to create an SBOM. For binary files analyzed by this plugin, additional JSON files will be generated containing vulnerability data extracted from the binaries. If there are duplicate hashed files, the extractor will check if they have the exported functions entries and skip remaking the output file if so.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines don't describe the reachability plugin.

Comment on lines +17 to +31
Example:
Output Filename: `reachability.json`

```json
{
"filename": {
"exp_func": {
"library": [
"imp_func1",
"imp_func2"
]
}
}
}
```

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this description is accurate either -- the json blob looks slightly different if I'm remembering correctly, and is added to the metadata list for software entries rather than being in a separate file.

}
```

The plugin's functionality can be toggled via Surfactant's plugin management features, using the plugin name `surfactantplugin_reachability.py` as defined in the `pyproject.toml` under the `project.entry-points."surfactant"` section.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin name to enable/disable it is surfactantplugin_reachability, without the .py suffix.

@github-actions

Copy link
Copy Markdown

✅ No SBOM Changes Detected

For commit 2f95acc (Run 16634709950)
Compared against commit 1b3fa13 (Run 16633319903)

@nightlark nightlark added the enhancement New feature or request label Sep 26, 2025
@KendallHarterAtWork

KendallHarterAtWork commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Testing the file test.cpp

extern "C" {

extern void direct();
extern void indirect();

[[gnu::visibility("hidden")]]
void internal_func()
{
    indirect();
}

void exported_func()
{
    direct();
    internal_func();
}

}

with the following command line

g++ -shared -o test.so -fPIC test.cpp

results in the following SBOM file:

{
  "systems": [],
  "hardware": [],
  "software": [
    {
      "UUID": "eb1ba532-7b4a-41c5-a4f7-964b49ac0280",
      "name": null,
      "size": 15376,
      "fileName": [
        "test.so"
      ],
      "installPath": [
        "test.so"
      ],
      "containerPath": [],
      "captureTime": 1781198489,
      "version": "",
      "vendor": [],
      "description": "",
      "sha1": "de60093da48bc0b1482d59c80be1ca79af949ab2",
      "sha256": "63c1286c2d2a72d39ba613dd3fdef217696100c0cb363a5918376694d873877d",
      "md5": "10215d77c7d448872bdefbe3c825a5ff",
      "relationshipAssertion": "Unknown",
      "comments": "",
      "metadata": [
        {
          "collectedBy": "Surfactant",
          "collectionPlatform": "Linux-6.6.114.1-microsoft-standard-WSL2-x86_64-with-glibc2.39",
          "fileInfo": {
            "mode": "-rwxr-xr-x",
            "hidden": false
          }
        },
        {
          "OS": "System V",
          "elfIdent": {
            "EI_CLASS": 2,
            "EI_DATA": 1,
            "EI_VERSION": 1,
            "EI_OSABI": 0,
            "EI_ABIVERSION": 0,
            "E_MACHINE": 62
          },
          "elfDependencies": [],
          "elfRpath": [],
          "elfRunpath": [],
          "elfSoname": [],
          "elfInterpreter": [],
          "elfDynamicFlags": [],
          "elfDynamicFlags1": [],
          "elfGnuRelro": true,
          "elfComment": [
            "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0"
          ],
          "elfNote": [
            {
              "sectionName": ".note.gnu.property",
              "name": "GNU",
              "type": "NT_GNU_PROPERTY_TYPE_0",
              "descdata": "\u0002\u0000\u0000\u00c0\u0004\u0000\u0000\u0000\u0003\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
            },
            {
              "sectionName": ".note.gnu.build-id",
              "name": "GNU",
              "type": "NT_GNU_BUILD_ID",
              "desc": "7099a706109fc4ba58755a730285049f16c6052e"
            }
          ],
          "elfOsAbi": "ELFOSABI_SYSV",
          "elfHumanArch": "x64",
          "elfArchNumber": 62,
          "elfArchitecture": "EM_X86_64",
          "elfIsExe": false,
          "elfIsLib": true,
          "elfIsRel": false,
          "elfIsCore": false
        },
        {
          "export_fn_reachability": {
            "exported_func": {
              "extern-address space": [
                "direct"
              ]
            }
          }
        }
      ],
      "supplementaryFiles": [],
      "provenance": null,
      "recordedInstitution": null,
      "components": []
    }
  ],
  "analysisData": [],
  "observations": [],
  "starRelationships": [],
  "relationships": []
}

@KendallHarterAtWork

Copy link
Copy Markdown
Collaborator

Attaching the zipped version of test.so (because GitHub doesn't allow direct uploading of an SO)
test.so.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants