LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-02-2016, 12:36 PM   #16
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78

I was thinking of putting some grep commands in to filter the tree output to try and weed out more stuff that is likely to be unimportant. Maybe adding some grep -v after the tree command to suppress lines that we needn't worry about. E.g.:
Code:
tree -aifFDpugs /blah /blah | grep -v "\]  \/var\/log" > snap1
But part of me wonders if defining these various filters might just be a really long, arduous, thankless process. Perhaps I should be looking into samhain or aide instead? Does no one ever need this kind of scrutiny for installers?
 
Old 12-02-2016, 01:43 PM   #17
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
I have noticed that a huge number of the differences in snap1 and snap2 are caused by changes in /var/lib/lxcfs. If I put a grep filter to exclude /var/lib/lxcfs, then my output is suddenly manageable.

But this raises the question "shouldn't I be watching that folder too?" If the point of this audit is security, then anyone aware of the process might hide nefarious activity in one of these folders that I'm ignoring. Is it safe to ignore these folders?
 
Old 12-02-2016, 02:24 PM   #18
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Using screen to manage your workflow is always a good idea, not really specific to this problem, so add it to your toolbox! I prefer Tmux, but similar idea. If you have questions about usage of those it might be better to open a separate thread for that.

Quote:
Originally Posted by sneakyimp View Post
I have noticed that a huge number of the differences in snap1 and snap2 are caused by changes in /var/lib/lxcfs. If I put a grep filter to exclude /var/lib/lxcfs, then my output is suddenly manageable.

But this raises the question "shouldn't I be watching that folder too?" If the point of this audit is security, then anyone aware of the process might hide nefarious activity in one of these folders that I'm ignoring. Is it safe to ignore these folders?
I think you asked and answered your own question there!

Your original question, "technique to observer *all* changes made to file system when installing something", would require that you monitor everything. There are some practical limitations you may want to apply to that such as /proc and /sys, but if you truly want to see *all* changes, and maybe even accesses as mentioned previously, then you are going to have to look at *all* possibilities.

For inotify based methods, you are looking at a stream of dynamically reported filesystem events, so you need confidence that it is reporting all events and missing none. My own expereince using that approach has resulted in low confidence that it will report everything.

For a diff based approach such as using tree, you must produce before and after snapshot lists for comparison. The lists must be as comprehensive as you want your audit to be.

Only you can decide how comprehensive you want that to be.
 
Old 12-02-2016, 02:47 PM   #19
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by astrogeek View Post
I think you asked and answered your own question there!
I'm not so sure, but it's hard to say because I don't know what these files are. Been looking into it a bit but lxcfs is a whole other rabbit hole. Hackers fiddling around in there doesn't seem as dangerous as one of them modifying /bin/ssh or /bin/bash, but I don't really know what a hacker might accomplish in there.

Quote:
Originally Posted by astrogeek View Post
Your original question, "technique to observer *all* changes made to file system when installing something", would require that you monitor everything. There are some practical limitations you may want to apply to that such as /proc and /sys, but if you truly want to see *all* changes, and maybe even accesses as mentioned previously, then you are going to have to look at *all* possibilities.
Well this introduces another question I guess: "Was I asking the right question?"
It occurs to me that hackers might hide stuff in these busy folders and no one would ever notice. Kinda like Han Solo parking the Millenium Falcon amid the garbage to escape from the Empire.

Quote:
Originally Posted by astrogeek View Post
For inotify based methods, you are looking at a stream of dynamically reported filesystem events, so you need confidence that it is reporting all events and missing none. My own expereince using that approach has resulted in low confidence that it will report everything.
I really appreciate this valuable insight. I'm using both tree and inotify because inotify reports access actions also. I wonder if this race condition problem is solvable? Has anyone told the devs?

Quote:
Originally Posted by astrogeek View Post
For a diff based approach such as using tree, you must produce before and after snapshot lists for comparison. The lists must be as comprehensive as you want your audit to be.
Well therein lies the conundrum. I suppose my decision will be based on what it is feasible to inspect. If I were to get a federal grant for a $1M I might hire some folks to help dig through it all.

Quote:
Originally Posted by astrogeek View Post
Only you can decide how comprehensive you want that to be.
This is a pretty sobering realization. The more I look into security, the harder it seems.
 
Old 12-02-2016, 03:20 PM   #20
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
If I'm absolutely suspicious of this application, I would not even bother to install it. Period.
If I'm just curious about it and as long as it can be installed by a regular user, I would give it a go.
 
Old 12-02-2016, 04:05 PM   #21
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by sneakyimp View Post
I'm not so sure, but it's hard to say because I don't know what these files are. Been looking into it a bit but lxcfs is a whole other rabbit hole. Hackers fiddling around in there doesn't seem as dangerous as one of them modifying /bin/ssh or /bin/bash, but I don't really know what a hacker might accomplish in there.


Well this introduces another question I guess: "Was I asking the right question?"
It occurs to me that hackers might hide stuff in these busy folders and no one would ever notice. Kinda like Han Solo parking the Millenium Falcon amid the garbage to escape from the Empire.
As for Lxcfs, start here and form your own conclusions, I have not explored it much.

The Han Solo tactic is a favorite of those who have gone over to the dark side!

Quote:
Originally Posted by sneakyimp View Post
I really appreciate this valuable insight. I'm using both tree and inotify because inotify reports access actions also. I wonder if this race condition problem is solvable? Has anyone told the devs?
It is mentioned in the man pages and other documentation, as noted earlier...

Quote:
BUGS
There are race conditions in the recursive directory watching code which can cause events to be missed
if they occur in a directory immediately after that directory is created. This is probably not fixable.

It is assumed the inotify event queue will never overflow.
That has been in there for as long as I have known of inotify, so apparently no one has found a way to fix it yet.

Quote:
Originally Posted by sneakyimp View Post
Well therein lies the conundrum. I suppose my decision will be based on what it is feasible to inspect. If I were to get a federal grant for a $1M I might hire some folks to help dig through it all.

This is a pretty sobering realization. The more I look into security, the harder it seems.
Yes, there is no plug-n-play for security. As often stated in various ways, security is a process and an attitude, not a program.
 
Old 12-02-2016, 06:52 PM   #22
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by c0wb0y View Post
If I'm absolutely suspicious of this application, I would not even bother to install it. Period.
If I'm just curious about it and as long as it can be installed by a regular user, I would give it a go.
I would not say I'm completely suspicious about it. There are a lot of reputable companies that use it to install their sdk/library, including Rackspace, Sendgrid, others. Let's just say I've seen some really poor conduct among library/plugin writers for various CMSes. There is a way to install it locally. It just want to know what it does.

And let's assume that this thread isn't so much about Composer as it is about creating some tools to calm my suspicions.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wich is the best file system for installing a Linux OS? Eridani Linux - Newbie 8 03-17-2016 08:49 PM
[SOLVED] how to verify file with gpg when you've to made .sig file yourself roberto32 Linux - Security 1 01-31-2014 09:41 AM
Observer pattern-The subject keeps track of the items to be observed by the observer Aquarius_Girl Programming 2 05-02-2012 08:53 AM
back up file system changes after installing a new software pablopla Linux - Newbie 7 12-20-2008 08:07 AM
Efficient search technique for text file of size 2 mb or more topworld Programming 5 04-03-2006 01:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration