|
--001636c928016bbed5047bce15ba
Content-Type: text/plain; charset=ISO-8859-1
This mitigation should help block attempts to exploit the IIS
semicolon zero-day (BID 37460), but no warranties and no guarantees.
It didn't crash my web servers during testing, but I make no
representations as to how it will or won't perform on anyone else's
web servers. This mitigation is only intended for IIS 4.0, 5.x, and
6.0; IIS 7.0 does not appear to be vulnerable (although in my testing,
IIS 4.0, 5.0, and 5.1 didn't appear to be vulnerable, either), and 7.5
is also reportedly not vulnerable.
If an attack is blocked, it should show up in the IIS logs with HTTP
status 403 and the made-up substatus 59; for example, on IIS 6.0:
2009-12-27 12:34:56 W3SVC1 169.254.123.200 GET /evil.asp;x.jpg - 80
- 169.254.123.100 Mozilla/4.0+(compatible;+MSIE+...) 403 59 0
When passed a malformed file name by IIS due to the vulnerability,
most (non-.NET) ISAPI extensions will process the file, including:
asp.dll / asp51.dll: .asa, .asp, .cdx, .cer, .htr
httpodbc.dll: .idc
ssinc.dll: .shtm, .shtml, .stm
So to get the most protection, you'll need to remap the file
extensions for each different ISAPI extension to a different copy of
the mitigation DLL -- it uses the file name with which it loads to
figure out which ISAPI extension it's wrapping. You'll also need to
set up the registry to tell it where to find the ISAPI extension it's
replacing. For example:
[HKEY_LOCAL_MACHINE\SOFTWARE\iissemi1]
"iissemi1_asp.dll" = "C:\WINDOWS\system32\inetsrv\asp.dll"
"iissemi1_ssinc.dll" = "C:\WINDOWS\system32\inetsrv\ssinc.dll"
Try out a malformed file name after deploying to make sure you have
everything set up properly.
Sorry I can't host an installer right now to automate all of this.
Hopefully most people won't need to use this mitigation, but if the
other options for reducing exposure aren't viable in your situation, I
hope this one will be.
-- Derek
P.S. The vulnerability can also be exploited if a subdirectory
containing ".xxx;" can be created; for instance, accessing
"/~y.asp;y/z.jpg" would cause "z.jpg" to be executed by the ASP ISAPI
extension as though it were an ASP script.
--001636c928016bbed5047bce15ba
Content-Type: text/plain; charset=US-ASCII; name="iissemi1_cpp.txt"
Content-Disposition: attachment; filename="iissemi1_cpp.txt"
Content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QsICZoa2V5ICkgIT0gRVJST1JfU1VDQ0VTUyApDQogICAgICAgIHsNCiAgICAgICAg
ICAgICAgICByZXR1cm4gRkFMU0U7DQogICAgICAgIH0NCg0KICAgICAgICBjYiA9IChzaXplb2Yo
Z193c3pJU0FQSSkgLSBzaXplb2YoZ193c3pJU0FQSVswXSkpOw0KDQogICAgICAgIGlmIChSZWdR
dWVyeVZhbHVlRXhXKCBoa2V5LCB3c3pWYWx1ZU5hbWUsIE5VTEwsICZkd3R5cGUsDQogICAgICAg
ICAgICAgICAgKExQQllURSlnX3dzeklTQVBJLCAmY2IgKSAhPSBFUlJPUl9TVUNDRVNTIHx8DQog
ICAgICAgICAgICAgICAgY2IgPCBzaXplb2YoZ193c3pJU0FQSVswXSkgfHwNCiAgICAgICAgICAg
ICAgICBjYiA+IChzaXplb2YoZ193c3pJU0FQSSkgLSBzaXplb2YoZ193c3pJU0FQSVswXSkpICkN
CiAgICAgICAgew0KICAgICAgICAgICAgICAgIFJlZ0Nsb3NlS2V5KCBoa2V5ICk7DQogICAgICAg
ICAgICAgICAgcmV0dXJuIEZBTFNFOw0KICAgICAgICB9DQoNCiAgICAgICAgUmVnQ2xvc2VLZXko
IGhrZXkgKTsNCg0KICAgICAgICBnX3dzeklTQVBJW2NiIC8gc2l6ZW9mKGdfd3N6SVNBUElbMF0p
XSA9IEwnXDAnOw0KDQogICAgICAgIGlmIChkd3R5cGUgPT0gUkVHX0VYUEFORF9TWikNCiAgICAg
ICAgew0KICAgICAgICAgICAgICAgIGN3Y2ggPSBFeHBhbmRFbnZpcm9ubWVudFN0cmluZ3NXKCBn
X3dzeklTQVBJLA0KICAgICAgICAgICAgICAgICAgICAgICAgd3N6LCAoKHNpemVvZih3c3opIC8g
c2l6ZW9mKHdzelswXSkpIC0gMSkgKTsNCg0KICAgICAgICAgICAgICAgIGlmICggY3djaCA9PSAw
IHx8DQogICAgICAgICAgICAgICAgICAgICBjd2NoID49IChzaXplb2Yod3N6KSAvIHNpemVvZih3
c3pbMF0pKSAtIDEpDQogICAgICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAgICAgICAg
cmV0dXJuIEZBTFNFOw0KICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAgIHdzeltj
d2NoXSA9IEwnXDAnOw0KDQogICAgICAgICAgICAgICAgbWVtY3B5KCBnX3dzeklTQVBJLA0KICAg
ICAgICAgICAgICAgICAgICAgICAgd3N6LCAoKGN3Y2ggKyAxKSAqIHNpemVvZihnX3dzeklTQVBJ
WzBdKSkgKTsNCiAgICAgICAgfQ0KICAgICAgICBlbHNlIGlmIChkd3R5cGUgIT0gUkVHX1NaKQ0K
ICAgICAgICAgICAgICAgIHJldHVybiBGQUxTRTsNCg0KICAgICAgICByZXR1cm4gVFJVRTsNCn0g
Ly9yZWFkX3JlZ19wYXRoDQoNCmNvbnN0IHdjaGFyX3QgKiBfX3djc3N0cmkoDQogICAgICAgIGNv
bnN0IHdjaGFyX3QgICAgICAgICAgICogX1N0ciwNCiAgICAgICAgY29uc3Qgd2NoYXJfdCAgICAg
ICAgICAgKiBfU3ViU3RyICkNCnsNCiAgICAgICAgc2l6ZV90ICAgICAgICAgICAgICAgICAgY3dj
aHN0ciwgY3djaHN1YjsNCg0KICAgICAgICBjd2Noc3RyID0gd2NzbGVuKCBfU3RyICk7DQogICAg
ICAgIGN3Y2hzdWIgPSB3Y3NsZW4oIF9TdWJTdHIgKTsNCg0KICAgICAgICBpZiAoY3djaHN0ciA8
IGN3Y2hzdWIpDQogICAgICAgICAgICAgICAgcmV0dXJuIDA7DQoNCiAgICAgICAgZm9yIChjd2No
c3RyIC09IGN3Y2hzdWI7IDsgY3djaHN0ci0tLCBfU3RyKyspDQogICAgICAgIHsNCiAgICAgICAg
ICAgICAgICBpZiAoX3djc25pY21wKCBfU3RyLCBfU3ViU3RyLCBjd2Noc3ViICkgPT0gMCkNCiAg
ICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfU3RyOw0KDQogICAgICAgICAgICAgICAgaWYg
KGN3Y2hzdHIgPT0gMCkgYnJlYWs7DQogICAgICAgIH0NCg0KICAgICAgICByZXR1cm4gMDsNCn0g
Ly9fX3djc3N0cmkNCg0KQk9PTCB0cnlfZGVmYXVsdHMoDQogICAgICAgIExQQ1dTVFIgICAgICAg
ICAgICAgICAgIHdzek15RmlsZU5hbWUgKQ0Kew0KICAgICAgICBMUENXU1RSICAgICAgICAgICAg
ICAgICB3c3pkbGw7DQoNCiAgICAgICAgaWYgKF9fd2Nzc3RyaSggd3N6TXlGaWxlTmFtZSwgTCJh
c3A1MSIgKSkNCiAgICAgICAgew0KICAgICAgICAgICAgICAgIGlmICggcmVhZF9yZWdfcGF0aCgg
TCJTT0ZUV0FSRVxcQ2xhc3Nlc1xcQ0xTSURcXCINCiAgICAgICAgICAgICAgICAgICAgICAgIEwi
e0Q5N0E2REEwLUE4NjEtMTFjZi05M0FFLTAwQTBDOTBDMkJEOH1cXCINCiAgICAgICAgICAgICAg
ICAgICAgICAgIEwiSW5wcm9jU2VydmVyMzIiLCBOVUxMICkgKQ0KICAgICAgICAgICAgICAgIHsN
CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUUlVFOw0KICAgICAgICAgICAgICAgIH0N
Cg0KICAgICAgICAgICAgICAgIHdzemRsbCA9IEwiXFxhc3A1MS5kbGwiOw0KICAgICAgICB9DQog
ICAgICAgIGVsc2UgaWYgKF9fd2Nzc3RyaSggd3N6TXlGaWxlTmFtZSwgTCJhc3AiICkpDQogICAg
ICAgIHsNCiAgICAgICAgICAgICAgICBpZiAoIHJlYWRfcmVnX3BhdGgoIEwiU09GVFdBUkVcXENs
YXNzZXNcXENMU0lEXFwiDQogICAgICAgICAgICAgICAgICAgICAgICBMIntEOTdBNkRBMC1BODYx
LTExY2YtOTNBRS0wMEEwQzkwQzJCRDh9XFwiDQogICAgICAgICAgICAgICAgICAgICAgICBMIklu
cHJvY1NlcnZlcjMyIiwgTlVMTCApICkNCiAgICAgICAgICAgICAgIC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CApOw0KICAgICAgICAgICAgICAgIHJldHVybiBUUlVFOw0KICAg
ICAgICB9DQoNCiAgICAgICAgZ193c3pJU0FQSVswXSA9IEwnXDAnOw0KICAgICAgICByZXR1cm4g
RkFMU0U7DQp9IC8vdHJ5X2RlZmF1bHRzDQoNCkJPT0wgbG9hZF9pc2FwaSgpDQp7DQogICAgICAg
IExQQ1dTVFIgICAgICAgICAgICAgICAgIHdjcDsNCiAgICAgICAgc2l6ZV90ICAgICAgICAgICAg
ICAgICAgaTsNCg0KICAgICAgICBFbnRlckNyaXRpY2FsU2VjdGlvbiggJmdfY3NXcmFwcGVycyAp
Ow0KDQogICAgICAgIF9fdHJ5DQogICAgICAgIHsNCiAgICAgICAgICAgICAgICBpZiAoZ19obUlT
QVBJICE9IE5VTEwpDQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFJVRTsNCg0KICAg
ICAgICAgICAgICAgIHdjcCA9IHdjc3JjaHIoIGdfd3N6TXlzZWxmLCBMJ1xcJyApOw0KICAgICAg
ICAgICAgICAgIGlmICh3Y3ApIHdjcCsrOyBlbHNlIHdjcCA9IGdfd3N6TXlzZWxmOw0KDQogICAg
ICAgICAgICAgICAgaWYgKCFyZWFkX3JlZ19wYXRoKCBMIlNPRlRXQVJFXFxpaXNzZW1pMSIsIHdj
cCApKQ0KICAgICAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdHJ5
X2RlZmF1bHRzKCB3Y3AgKSkNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJu
IEZBTFNFOw0KICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAgIGdfaG1JU0FQSSA9
IExvYWRMaWJyYXJ5VyggZ193c3pJU0FQSSApOw0KICAgICAgICAgICAgICAgIGlmIChnX2htSVNB
UEkgPT0gTlVMTCkgcmV0dXJuIEZBTFNFOw0KDQogICAgICAgICAgICAgICAgZm9yICggaSA9IDA7
DQogICAgICAgICAgICAgICAgICAgICAgaSA8IChzaXplb2YoTE9PS1VQKSAvIHNpemVvZihMT09L
VVBbMF0pKTsgaSsrICkNCiAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgICAgICAg
ICAqKHZvaWQgKiAqKShMT09LVVBbaV0ucHBmbikgPQ0KICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAodm9pZCAqKUdldFByb2NBZGRyZXNzKA0KICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgIGdfaG1JU0FQSSwgTE9PS1VQW2ldLnN6ICk7DQogICAgICAgICAgICAg
ICAgfQ0KICAgICAgICB9DQogICAgICAgIF9fZmluYWxseQ0KICAgICAgICB7DQogICAgICAgICAg
ICAgICAgTGVhdmVDcml0aWNhbFNlY3Rpb24oICZnX2NzV3JhcHBlcnMgKTsNCiAgICAgICAgfQ0K
DQogICAgICAgIHJldHVybiBUUlVFOw0KfSAvL2xvYWRfaXNhcGkNCg0KLy8vLy8vLy8vLy8vLy8v
Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLw0KLy8gSVNB
UEkgZXh0ZW5zaW9uIHJlcGxhY2VtZW50IGV4cG9ydHMNCi8vLy8vLy8vLy8vLy8vLy8vLy8vLy8v
Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8NCg0KQk9PTCBXSU5BUEkg
QXNwU3RhdHVzSHRtbER1bXAoDQogICAgICAgIFBWT0lEICAgICAgICAgICAgICAgICAgIHBBcmcw
LA0KICAgICAgICBQVk9JRCAgICAgICAgICAgICAgICAgICBwQXJnMSApDQp7DQogICAgICAgIGlm
ICghbG9hZF9pc2FwaSgpIHx8IGdfcGZuQXNwU3RhdHVzSHRtbER1bXAgPT0gTlVMTCkNCiAgICAg
ICAgICAgICAgICByZXR1cm4gRkFMU0U7DQoNCiAgICAgICAgcmV0dXJuIGdfcGZuQXNwU3Rh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BmZGFuZ2VyID0gRkFMU0U7DQoN
CiAgICAgICAgICAgICAgICBpZiAoc3RyY2hyKCBwRUNCLT5scHN6UGF0aFRyYW5zbGF0ZWQsICc7
JyApKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZmRhbmdlciA9IFRSVUU7DQoNCiNpZiAxIC8v
IGFsc28gY2hlY2sgZm9yIGNvbG9uIHRoYXQgZG9lc24ndCBiZWxvbmcNCiAgICAgICAgICAgICAg
ICBjcCA9IHBFQ0ItPmxwc3pQYXRoVHJhbnNsYXRlZDsNCg0KICAgICAgICAgICAgICAgIGlmICgg
Y3BbMF0gPT0gJ1xcJyAmJiBjcFsxXSA9PSAnXFwnICYmDQogICAgICAgICAgICAgICAgICAgICAo
Y3BbMl0gPT0gJy4nIHx8IGNwWzJdID09ICc/JykgJiYNCiAgICAgICAgICAgICAgICAgICAgIGNw
WzNdID09ICdcXCcgJiYgY3BbNF0gIT0gJ1wwJyAmJiBjcFs1XSA9PSAnOicgKQ0KICAgICAgICAg
ICAgICAgIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIGNwICs9IDY7DQogICAgICAgICAgICAg
ICAgfQ0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKCBjcFswXSA9PSAnXFwnICYmIGNwWzFdID09
ICc/JyAmJg0KICAgICAgICAgICAgICAgICAgICAgICAgICBjcFsyXSA9PSAnPycgJiYgY3BbM10g
PT0gJ1xcJyAmJg0KICAgICAgICAgICAgICAgICAgICAgICAgICBjcFs0XSAhPSAnXDAnICYmIGNw
WzVdID09ICc6JyApDQogICAgICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAgICAgICAg
Y3AgKz0gNjsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgZWxzZSBpZiAoY3Bb
MF0gIT0gJ1wwJyAmJiBjcFsxXSA9PSAnOicpDQogICAgICAgICAgICAgICAgew0KICAgICAgICAg
ICAgICAgICAgICAgICAgY3AgKz0gMjsNCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAg
ICAgICBpZiAoc3RyY2hyKCBjcCwgJzonICkpDQogICAgICAgICAgICAgICAgICAgICAgICBmZGFu
Z2VyID0gVFJVRTsNCiNlbmRpZg0KDQogICAgICAgICAgICAgICAgaWYgKGZkYW5nZXIpDQogICAg
ICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBFQ0ItPlNlcnZlclN1
cHBvcnRGdW5jdGlvbiAhPSBOVUxMKQ0KICAgICAgICAgICAgICAgICAgICAgICAgew0KICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICBwRUNCLT5TZXJ2ZXJTdXBwb3J0RnVuY3Rpb24oDQog
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcEVDQi0+Q29ubklELA0KICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEhTRV9SRVFfU0VORF9SRVNQT05T
RV9IRUFERVIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIjQwMyBG
b3JiaWRkZW4iLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEws
IE5VTEwgKTsNCg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoc2VlcnIucHN6U3Rh
dHVzID0gIjQwMyBGb3JiaWRkZW4iOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBo
c2VlcnIudUh0dHBTdWJFcnJvciA9IDU5Ow0KDQogICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIHBFQ0ItPlNlcnZlclN1cHBvcnRGdW5jdGlvbigNCiAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICBwRUNCLT5Db25uSUQsDQogICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgSFNFX1JFUV9TRU5EX0NVU1RPTV9FUlJPUiwNCiAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICA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ICAgICAgICAgICBoaW5zdERMTCwNCiAg
ICAgICAgRFdPUkQgICAgICAgICAgICAgICAgICAgZmR3UmVhc29uLA0KICAgICAgICBMUFZPSUQg
ICAgICAgICAgICAgICAgICBscHZSZXNlcnZlZCApDQp7DQogICAgICAgIERXT1JEICAgICAgICAg
ICAgICAgICAgIGN3Y2g7DQoNCiAgICAgICAgaWYgKGZkd1JlYXNvbiA9PSBETExfUFJPQ0VTU19B
VFRBQ0gpDQogICAgICAgIHsNCiAgICAgICAgICAgICAgICBjd2NoID0gR2V0TW9kdWxlRmlsZU5h
bWVXKCBoaW5zdERMTCwgZ193c3pNeXNlbGYsDQogICAgICAgICAgICAgICAgICAgICAgICAoICgg
c2l6ZW9mKGdfd3N6TXlzZWxmKSAvDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9m
KGdfd3N6TXlzZWxmWzBdKSApIC0gMSApICk7DQoNCiAgICAgICAgICAgICAgICBpZiAoIGN3Y2gg
PT0gMCB8fA0KICAgICAgICAgICAgICAgICAgICAgY3djaCA+PSAoICggc2l6ZW9mKGdfd3N6TXlz
ZWxmKSAvDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoZ193c3pNeXNl
bGZbMF0pICkgLSAxICkgKQ0KICAgICAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICAgICAg
ICAgIHJldHVybiBGQUxTRTsNCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICBJ
bml0aWFsaXplQ3JpdGljYWxTZWN0aW9uKCAmZ19jc1dyYXBwZXJzICk7DQogICAgICAgICAgICAg
ICAgZ19obUlTQVBJID0gTlVMTDsNCiAgICAgICAgICAgICAgICBnX3dzeklTQVBJWzBdID0gTCdc
MCc7DQogICAgICAgIH0NCiAgICAgICAgZWxzZSBpZiAoZmR3UmVhc29uID09IERMTF9QUk9DRVNT
X0RFVEFDSCkNCiAgICAgICAgew0KICAgICAgICAgICAgICAgIC8vIGRvIHRoaXMgaW4gVGVybWlu
YXRlRXh0ZW5zaW9uPw0KICAgICAgICAgICAgICAgIC8vaWYgKGdfaG1JU0FQSSAhPSBOVUxMKQ0K
ICAgICAgICAgICAgICAgIC8vew0KICAgICAgICAgICAgICAgIC8vICAgICAgICBGcmVlTGlicmFy
eSggZ19obUlTQVBJICk7DQogICAgICAgICAgICAgICAgLy8gICAgICAgIGdfaG1JU0FQSSA9IE5V
TEw7DQogICAgICAgICAgICAgICAgLy99DQoNCiAgICAgICAgICAgICAgICBEZWxldGVDcml0aWNh
bFNlY3Rpb24oICZnX2NzV3JhcHBlcnMgKTsNCiAgICAgICAgfQ0KDQogICAgICAgIHJldHVybiBU
UlVFOw0KfSAvL0RsbE1haW4NCg=--001636c928016bbed5047bce15ba--