Live data from Hacker News

Run sudo -k, set your clock to 01.01.1970, run sudo su and boom you're root

twitter.com

51–60 of 74 posts

Re: Run sudo -k, set your clock to 01.01.1970, run sudo su and boom you're root

#51

From the FreeBSD man for date Only the superuser may set the date, and if the system securelevel (see securelevel(7)) is greater than 1, the time may not be changed by more than 1 second. EDIT: so you need to be root anyway or have root access to change the date.

Would this work with an LD_PRELOAD of libfaketime?

Re: Run sudo -k, set your clock to 01.01.1970, run sudo su and boom you're root

#54
post #32

I wonder if it would be possible to walk back the date using an ntp mitm attack.

It won't. An NTP client will refuse to update it's system clock back to Epoch. There's a threshold after which ntpdate will refuse to adjust the clock.

Re: Run sudo -k, set your clock to 01.01.1970, run sudo su and boom you're root

#55
post #51

From the FreeBSD man for date Only the superuser may set the date, and if the system securelevel (see securelevel(7)) is greater than 1, the time may not be changed by more than 1 second. EDIT: so you need to be root anyway or have root access to change the date.

Would this work with an LD_PRELOAD of libfaketime?

    env_reset    
        
    If set, sudo will run the command in a minimal
    environment containing the TERM, PATH, HOME, MAIL,
    SHELL, LOGNAME, USER, USERNAME and SUDO_* variables.
    Any variables in the caller's environment that match
    the env_keep and env_check lists are then added,
    followed by any variables present in the file specified
    by the env_file option (if any).  The default contents
    of the env_keep and env_check lists are displayed when
    sudo is run by root with the -V option.  If the
    secure_path option is set, its value will be used for
    the PATH environment variable.  This flag is on by
    default.

Also this would open up an entire vector of arbitrary command execution attacks if it was allowed.

Also, you can not use LD_PRELOAD on sudo itself, as it is disabled for setuid binaries.

Re: Run sudo -k, set your clock to 01.01.1970, run sudo su and boom you're root

#56
post #16

From the FreeBSD man for date Only the superuser may set the date, and if the system securelevel (see securelevel(7)) is greater than 1, the time may not be changed by more than 1 second. EDIT: so you need to be root anyway or have root access to change the date.

Users on MacOS can change the time without root access.

[deleted]

Re: Run sudo -k, set your clock to 01.01.1970, run sudo su and boom you're root

#57
post #30

Earlier quoted context omitted.

How are they going to change the date without having a path to superuser access already?

They could potentially spoof the machine's NTP server.

You're building up a great big chain of complicated requirements. You're quickly approaching the point where it's easier to steal the machine.

Re: Run sudo -k, set your clock to 01.01.1970, run sudo su and boom you're root

#58
post #30

Earlier quoted context omitted.

How are they going to change the date without having a path to superuser access already?

They could potentially spoof the machine's NTP server.

You mean, all of the NTP servers the machine uses. NTP will detect and reject a single server reporting bad time (assuming you have at least 3 servers configured, which is the recommendation).

You'd also have to do this when the NTP daemon first starts up, as:

       -g      Normally, ntpd exits with a message to the system  log  if  the  offset  exceeds  the  panic
               threshold,  which  is  1000 s by default. This option allows the time to be set to any value
               without restriction; however, this can happen only once. If the threshold is exceeded  after
               that,  ntpd  will exit with a message to the system log. This option can be used with the -q
               and -x options. See the tinker command for other options.

Re: Run sudo -k, set your clock to 01.01.1970, run sudo su and boom you're root

#59
post #32

I wonder if it would be possible to walk back the date using an ntp mitm attack.

       -g      Normally, ntpd exits with a message to the system  log  if  the  offset  exceeds  the  panic
               threshold,  which  is  1000 s by default. This option allows the time to be set to any value
               without restriction; however, this can happen only once. If the threshold is exceeded  after
               that,  ntpd  will exit with a message to the system log. This option can be used with the -q
               and -x options. See the tinker command for other options.
Post reply on HN