Coder Social home page Coder Social logo

seungkang / oki Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 44 KB

oki applies pledge(2) and unveil(2) restrictions to target-program, reducing the blast radius of a security vulnerability in target-program.

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%
openbsd pledge unveil

oki's Issues

elf-deps: Make single quotes and backslashes optional

When parsing an ELF with -R, oki includes single quotes and backslashes in the output to help write shell scripts. For example:

$ oki -R rizin
-u 'r:/usr/local/lib/librz_util.so.0.7' \
-u 'r:/usr/lib/libm.so.10.1' \
-u 'r:/usr/lib/libutil.so.17.0' \
(...)

It would be nice if we could make this behavior optional so it does this instead:

$ oki -R rizin
-u r:/usr/local/lib/librz_util.so.0.7
-u r:/usr/lib/libm.so.10.1
-u r:/usr/lib/libutil.so.17.0
(...)

The latter format makes it easier to create shared config files that can be used in multiple shell scripts. For example:

#!/bin/sh

set -u

work_dir="${OKI_WORKDIR:-${HOME}/memla}"

oki \
  -p stdio \
  (...)
  -u rwc:/tmp \
  -u r:/usr/libexec/ld.so \
  -u r:/usr/lib \
  -u r:/usr/lib/libc.so.97.0 \
  $(/bin/cat /tmp/rules-example.txt) \
  -- rizin $@

... where /tmp/rules-example.txt contains:

-u r:/usr/local/lib/librz_util.so.0.7
-u r:/usr/lib/libm.so.10.1
-u r:/usr/lib/libutil.so.17.0
(...)

Perhaps this can even be the default behavior and the current behavior can be optional?

elf-deps: Imported library as file path is not supported and returns error.

When using -R to generate unveil rules for dependent libraries, program returns an error if the imported library is a file path. Not sure how common it is for an imported library to be a file path but it occurs with the rizin package.

Example:

$ oki -R rizin
fatal: failed to get ELF dependencies unveil paths - imported library contains / - /usr/local/lib/<some-library>

Possible Fixes

Adding support for libraries that are file paths, so long as they are prefixed with the paths in the runPaths variable. We need to call filepath.Clean() and filepath.Abs() on both the runPaths variable and the imported library if it is a file path.

elf-deps: -R on git fails with: could not find library: "libiconv.so.7.1" - searched in ["/usr/lib"]

Ran -R on git and returned with error:

$ oki -R git
fatal: failed to get ELF dependencies unveil paths - could not find library: "libiconv.so.7.1" - searched in ["/usr/lib"]

Library is in /usr/local/lib.

$ find /usr -type f -name libiconv.so.7.1
/usr/local/lib/libiconv.so.7.1

Possible Fixes

We want to check if /usr/local/lib is in git's DT_RUNPATH or any of its libraries' DT_RUNPATH.
If it isn't, we should consider checking there by default.
We should review how ld.so works and read manual page. (man ld.so)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.