Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How best to hide command-line arguments from ps command?

by hanenkamp (Pilgrim)
on Nov 18, 2003 at 21:41 UTC ( [id://308140]=note: print w/replies, xml ) Need Help??


in reply to How best to hide command-line arguments from ps command?

Not necessarily. For example, under Linux with a /proc filesystem: I just have to browse to /proc/<pid>/environ and look at it--of course, I would still need the correct permissions to read the environ pseudo-file. In any case, I wouldn't consider this safe since the environment isn't really a secure store.

You can turn off echo on the tty in Perl just as easily as with stty:

use Term::Readkey; ReadMode "noecho"; $password = <STDIN>; ReadMode "restore";

Replies are listed 'Best First'.
Re: Re: How best to hide command-line arguments from ps command?
by etcshadow (Priest) on Nov 18, 2003 at 22:20 UTC
    Well, the permissions that you would need to pull that off (reading another user's environment from the /proc filesystem) are root permissions, and you've got to assume that absolutely anything you do can be evesdropped on by root, anyway.

    There's two classes of people that you can't avoid trusting (implicitly or explicitly):

    • root user (or anyone able to assume root)
    • anyone who has physical access to your machine
    They can see and interfere with anything you do. Granted, it may be very hard to pull off, but it can be done. This is why access control and physical security cannot be overemphasized.

    ------------
    :Wq
    Not an editor command: Wq

      Not all versions of Unix hide the contents of a user's environment from other users. On Solaris, for example, /usr/ucb/ps -augxwwwe will show you other users' processes' environment variables.

        Interesting... even when not run as root, and the process belongs to another user? I mean... on linux, ps can list environment, but only of processes which the executing user has privelege over. And the reason, fundamentally, is that the O/S just doesn't give out that information. The /proc filesystem and the ps command are just different means of accessing it.

        I guess one thing that could explain that is if the ps binary was setuid root. But that would indicate frighteningly bad systems administration.

        I'd actually be kind of surprised (but I could believe still it) that solaris has less security partitioning than linux.


        ------------
        :Wq
        Not an editor command: Wq

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://308140]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found