Wednesday, July 7, 2021

How To Run ANY COMMAND As The Owner Of The Script (setuid)

1. Save the below code as file a.c
    int main(int ac, char **av) {
        int uid;
        uid = geteuid();
        setreuid(uid, uid);

        char **arguments = av + 1;
        system(*arguments);

        return 0;
    }
2. As userA, compile it, ie
    gcc a.c -o aaa
3. As userA, set the sticky bit, ie
    chmod 4755 aaa
4. now you can run any command as UserA, like this:
    >aaa 'whoami'
    userA

    >aaa 'touch file1'
    >ls -al file1
    -rw-r----- 1 userA group

How To Install MySql

  Preparation ssh ascy00224 mkdir -p /infrastructure/agk mkdir -p /infrastructure/agk/sqldb mkdir -p /infrastructure/agk/log mkdir -p /infra...