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

Problem: T1574.006 /etc/ld.so.preload not deleted and sudo messed up #2944

Open
iosonogio opened this issue Sep 20, 2024 · 0 comments
Open

Comments

@iosonogio
Copy link

iosonogio commented Sep 20, 2024

What did you do?

Invoke-AtomicTest T1574.006 -TestNumber 1
Invoke-AtomicTest T1574.006 -TestNumber 1 -Cleanup

What did you expect to happen?

The file /etc/ld.so.preload should be deleted.

What happened instead?

The file /etc/ld.so.preload is not deleted, and I get this message from sudo: "sudo: account validation failure, is your account locked?" The fact that sudo fails, has a nasty side effect as the user cannot logon anymore nor "sudo" anymore.
It seems that sudo is messed up by the library being preloaded (my educated guess).

The problem disappears after I delete /etc/ld.so.preload.

The problem does not come up if commands are rewritten without "sudo" in the yaml

There are also a couple of other issues with the commands:

  1. The test command is overwriting any potentially existing /etc/ld.so.preload (we may fairly assume it didn't exist, but then why are we using sed to cleanup instead of a simple rm ?)
  2. In the cleanup command the regex delimiters are confusing, better use a different delimiter: sudo sed -i 's|#{path_to_shared_library}||' /etc/ld.so.preload
executor:
    command: |
      sudo sh -c 'echo #{path_to_shared_library} > /etc/ld.so.preload'
    cleanup_command: |
      sudo sed -i 's##{path_to_shared_library}##' /etc/ld.so.preload
    name: bash
    elevation_required: true

Your Environment

  • Amazon Linux 2023.5.20240916 (basically a RedHat)
  • I run the test from elevated prompt (sudo -i), and then launching pwsh (Powershell on Linux)
  • Relevant to T1574.006 (but cannot exclude others)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant