Skip to content

KPL Binary installation uses a Shared Lock #91

Closed
@skidder

Description

The KPL binary is vulnerable to a race condition that yields a zero-byte binary file being installed. The sequence is:

  1. Process-1 determines that the binary does not exist and creates a new FileOutputStream, which will create a file-descriptor on the filesystem (link)
  2. Process-2 determines that the file exists and creates a FileInputStream and shared lock: (link)
  3. Process-1 attempts to create an exclusive lock but cannot because Process-2 has a shared-lock that prevents the creation of exclusive locks: (link)
  4. Process-2 verifies the contents of the binary and throws a SecurityException because the contents do not match the expected value: (link)

This can be avoided by using a dedicated lock-file separate from the binary file being written.

This issue is related to #55

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions