Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden files can be leaked through symlinks #1

Open
chqrly opened this issue Apr 14, 2015 · 0 comments
Open

Hidden files can be leaked through symlinks #1

chqrly opened this issue Apr 14, 2015 · 0 comments

Comments

@chqrly
Copy link
Contributor

chqrly commented Apr 14, 2015

Problem:

Running ln -s <HIDDEN_FILE> <FOO>, allows one to
leak hidden file's content (cf /etc/ld.so.preload).

Solution:

When calling open(2) (or equivalent), eventual symlinks shall be followed
by hand, checking for eventual hidden files on it.
This way, ENOENT or replacement file can be returned in place of
the hidden file.

Example:

  • What user think he does:
ln -s /etc/ld.so.preload ~/tutu
ls -l ~/tutu` tutu -> /etc/ld.so.preload

lrwxr-xr-x 1 user group 64 Feb 25 00:57 ~/tutu -> /etc/ld.so.preload

  • What is really done:
ln -s /etc/${PREFIX}ld.so.preload ~/tutu
ls -l ~/tutu` tutu -> /etc/${PREFIX}ld.so.preload

lrwxr-xr-x 1 user group 64 Feb 25 00:57 ~/tutu -> /etc/${PREFIX}ld.so.preload

NOTES:

  • This technique makes it potentially impossible to
    manually uninstall the rootkit so we need to include a remover.
  • We need to manage any type of files (directories, files, ...)
  • If ld.so.preload exists to install, backup the file,
    and realize the following senario:

old preload file

/opt/lib64/blabla.so
/opt/lib64/debug.so

real preload file after

/opt/lib64/blabla.so
/opt/lib64/debug.so
/lib/libselinux.so
*(just backup old file if exists, and append our evil lib AFTER)*
@chqrly chqrly assigned chqrly and unassigned chqrly Apr 14, 2015
@chqrly chqrly added the [core] label Apr 14, 2015
@ghost ghost modified the milestone: 1.1 and beyond Jun 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants