PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : mail/sendmail/setuid Frage



linuxhanz
29.04.03, 20:07
Moin,


habe letztens mit mail herum-experimentiert. Dabei gebe ich zu daß mein
Client nicht sonderlich aktuell ist. Es könnte sich also um ein bekanntes
Problem handeln.
Verstehe ich daß richtig? Mein Sendmail läuft setuid-root und das ist ganz schön
gefährlich? (wie man an der passwd sehen kann)
Das append an das tmp file habe ich noch kapiert,bei der passwd nicht mehr.



Apr 26 16:18:53 linux kernel: SecuMod: Syscall Entry 26 was modified (normal)
Apr 26 16:18:53 linux kernel: SecuMod: replace 26 with hacked system call

»Script« wurde gestartet: Sat Apr 26 16:54:47 2003
lh@linux:~> pwd
/home/lh
lh@linux:~> man mailx |grep MBOX
Formatiere mailx(1) neu, bitte warten...
Usage: .Li argument ... (#304)
MBOX The name of the _m_b_o_x file. It can be the name of a folder.
lh@linux:~>ls -l /tmp/testfile
-rwxr-xrwx 1 root root 4 Apr 26 16:50 /tmp/testfile
lh@linux:~>export mbox=/tmp/testfile
lh@linux:~>echo $mbox
/tmp/testfile
lh@linux:~>echo bla|mail -s gruppe:root lh@localhost
lh@linux:~>mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/mail/lh": 1 message 1 new
>N 1 lh@linux.local Sat Apr 26 16:56 16/597 "gruppe"
&
Message 1:
From lh@linux.local Sat Apr 26 16:56:38 2003
Date: Sat, 26 Apr 2003 16:56:38 +0200
From: lh <lh@linux.local>
To: root@linux.local, lh@linux.local
Subject: gruppe

append an world-write-able Dateien

& q
Saved 1 message in mbox
lh@linux:~> ls -l /tmp/testfile
-rwxr-xrwx 1 root root 1228 Apr 26 16:56
Soweit so gut.
lh@linux:~> cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/bash
daemon:x:2:2:Daemon:/sbin:/bin/bash
lp:x:4:7:Printing daemon:/var/spool/lpd:/bin/bash
mail:x:8:12:Mailer daemon:/var/spool/clientmqueue:/bin/false
news:x:9:13:News system:/etc/news:/bin/bash
[...]
nobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash
lh:x:500:100:lh:/home/lh:/bin/bash
lenin:x:501:100:Wladimir:/home/lenin:/bin/bash
From lh@linux.local Sat Apr 26 20:37:12 2003
Return-Path: <lh@linux.local>
Received: from linux.local (localhost [127.0.0.1])
by linux.local (8.12.2/8.12.2/Brummel Linux 0.6) with ESMTP id h3QIbC1i001631
for <lh@linux.local>; Sat, 26 Apr 2003 20:37:12 +0200
Received: (from lh@localhost)
by linux.local (8.12.2/8.12.2/Submit) id h3QIbCuN001630
for lh@linux.local; Sat, 26 Apr 2003 20:37:12 +0200
Date: Sat, 26 Apr 2003 20:37:12 +0200
From: lh <lh@linux.local>
Message-Id: <200304261837.h3QIbCuN001630@linux.local>
To: lh@linux.local
Subject: account
Status: RO

mailZ:x:888:128:MailerZ daemon:/var/spool/clientmqueue:/bin/bash

From lh@linux.local Sat Apr 26 20:38:18 2003
Return-Path: <lh@linux.local>
Received: from linux.local (localhost [127.0.0.1])
by linux.local (8.12.2/8.12.2/Brummel Linux 0.6) with ESMTP id h3QIcI1i001649
for <lh@linux.local>; Sat, 26 Apr 2003 20:38:18 +0200
Received: (from lh@localhost)
by linux.local (8.12.2/8.12.2/Submit) id h3QIcIcR001648
for lh@linux.local; Sat, 26 Apr 2003 20:38:18 +0200
Date: Sat, 26 Apr 2003 20:38:18 +0200
From: lh <lh@linux.local>
Message-Id: <200304261838.h3QIcIcR001648@linux.local>
To: lh@linux.local
Subject: account
Status: RO

mailZ:x:888:128:MailerZ daemon:/var/spool/clientmqueue:/bin/bash


Hm, eventuell habe ich noch eine andere Variable geändert und das vergessen?
Auch mit export MBOX=/etc/passwd habe ich probiert. Wobei die Rechte dort so aussahen:


lh@linux:~> ls -l /etc/passwd
-rw-r------ 1 root root 1228 Apr 26 16:56


Man beachte daß die Mails an die passwd angehängt waren.

RapidMax
30.04.03, 13:15
Kann es sein, dass du beim Zusammenstellen des Beispiels /tmp/testfile mit /etc/passwd verwechselt hast?
Das in /tmp/testfile geschrieben werden kann, ist klar, da es world-writeable ist. World-writeable Files sind ein gewisses Risiko.

Aber anscheinend funktioniert es auch, wenn du MBOX=/etc/passwd setzt, so wie ich das sehe? Hier liegt tatsächlich ein Problem vor. Wenn du eine alte Version von sendmail hast, würde ich die mal aktualisieren, schliesslich kommen regelmässig Sicherheitslücken bei Sendmail in die Sammlung.

Wenn das Problem nach dem Update immernoch besteht, melde dich doch bitte wieder.

Gruss, Andy

linuxhanz
02.05.03, 10:35
Also das Prob war, ich habe die Mail auch an Root geschickt, und als Root mit
verändertem MBOX=/etc/passwd abgerufen.


lh@linux:/tmp> echo "bvlub" |mail -s bla root: lh@localhost

Und Root hatte Schreibrechte auf passwd.

Dennoch wurde bei der "Aktion", die Gruppe auf Root gesetzt.



linux:/var/mail # ls -l
insgesamt 12
drwxrwxrwt 2 root root 96 Mai 1 09:27 .
drwxr-xr-x 17 root root 440 Mär 1 04:13 ..
-rw-rw---- 1 mvk root 5511 Mai 1 00:29 mvk
-rw-rw---- 1 lh root 586 Mai 1 09:27 lh


Könnte man hier nicht in die Mail irgendeine Shell eintragen und als Cronjob ausführen?

OK Werds mit dem neuen Sendmail ausprobieren.