You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
2,9,7 Appl Error 1000 in w3wp.exe Module ucrtbase.dll #3397
1.- Open Windows Settings
2.- Navigate to Apps > Installed Apps
3.- Locate the following:
• Microsoft Visual C++ 20XX Redistributable - x64
• Microsoft Visual C++ 20XX Redistributable - x86
4.- Uninstall
I think if the cause is the module, then we can reproduce it on other platform too. Could you sent the file which triggers this error to modsecurity@owasp.org?
I uninstalled the old versions of VS Visual C++ (2008 / 2020), so only 2015-2022 left and reinstalled modsecurity.
no old c++ version was installed
but error still exists.
Could you check the SecRequestBodyLimit value? I know your image's size is "only" 4.6MB, but to be sure...
Btw when a client uploads a file, it converts that into BASE64 format, which has a bigger size. The multiplier is 4/3, so if your file is 1MB, the base64 encoded data will be 1.33 MB. And you should set this value (or a bit higher) as SecRequestBodyLimit.
Other question: are you able to configure debug.log in IIS? If yes, please do that, and share the debug log (in private - send it to the mail address) when you upload that file.
Revisiting this one. Exception code c0000409 from ucrtbase.dll is a stack buffer overrun, and @A13501350's open PR #3624 ("IIS: fix ReadFileChunk latent overflow, allocate m_dwPageSize not 1") fixes a buffer sized at one byte in the IIS module's request body reading, which is exactly where a 4.5 MB upload would trip it. Reviewing that PR is the next step; if the crash persists afterwards this needs a WER dump.
Closing: #3624 (merged into v2/master) fixes the IIS module's ReadFileChunk buffer that was allocated with 1 byte instead of a page, which matches this stack buffer overrun on large uploads. If the crash still happens on a build that includes it, please reopen with a WER dump.
I tested this on Windows Server 2025 (GitHub Actions windows-latest) against current v2/master (03bbda9a, which already includes #3624), and #3397 still reproduces identically (w3wp.exe, ucrtbase.dll, exception 0xc0000409, offset 0x000000000001cba8).
From the WER dump (cdb.exe.ecxr; k), it is not related to #3624 (ReadFileChunk on response bodies) and is not a stack buffer overrun — it is Subcode: 0x5 FAST_FAIL_INVALID_ARG (ucrtbase!invoke_watson) triggered by write(msr->msc_reqbody_fd, ...) with fd = -1 inside modsecurity_request_body_store_disk():
With the default Windows config (SecRuleEngine DetectionOnly, SecRequestBodyInMemoryLimit 131072, SecTmpDir c:\inetpub\temp\), IIS AppPool identities do not have write permission to C:\inetpub\temp out of the box.
When an upload exceeds 128 KB, modsecurity_request_body_store_memory() switches msr->msc_reqbody_storage to MSC_REQBODY_DISKbeforemodsecurity_request_body_start_init() fails (msc_reqbody_fd = -1).
read_request_body() in apache2/apache2_io.c ignored rcbs == -1 under DetectionOnly and kept reading chunks, so the very next chunk called modsecurity_request_body_store_disk() -> write(-1, ...) and crashed w3wp.exe in ucrtbase.dll (on Linux, write(-1, ...) simply returns EBADF instead of crashing the process, which explains why it did not reproduce there).
I have opened #3796 with a fix and verified both go-ftw and all 7 upload/crash scenarios on windows-latest with zero w3wp.exe crashes.
Activity
airween commentedon Jun 6, 2025
Hi @FrankWarius,
I think if the cause is the module, then we can reproduce it on other platform too. Could you sent the file which triggers this error to modsecurity@owasp.org?
FrankWarius commentedon Jun 6, 2025
why do ship and install such an old MS Visual c++ version.
i primary use
also installed
airween commentedon Jun 6, 2025
Sorry, I don't have any Windows system.
FrankWarius commentedon Jun 6, 2025
I uninstalled the old versions of VS Visual C++ (2008 / 2020), so only 2015-2022 left and reinstalled modsecurity.
no old c++ version was installed
but error still exists.
dune73 commentedon Jun 6, 2025
Photo got here just find. Thanks.
airween commentedon Jun 10, 2025
I tried to upload the given file, and I couldn't reproduce your issue.
Could you show the request (eg. a curl command) what triggers the problem?
FrankWarius commentedon Jun 12, 2025
I am using Wordpres 6.8.1 with PHP 8.4.8 on Windows NT Server 10.0 build 26100 (Windows Server 2025) AMD64.
i am using Drag and Drop (on the server)
Wordpress returns
Windows Application log
IIS Log
05:31:01 | ip | POST | /wp-admin/admin-ajax.php | - | 443 | - | ip | Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64) | https://xxx.yyy.de/wp-admin/upload.php | 200 | 0 | 0 | 586
05:32:01 | ip | POST | /wp-cron.php | doing_wp_cron | 443 | - | ip | WordPress/6.8.1;+https://xxx.yyy.de | - | 200 | 0 | 0 | 346
05:32:01 | ip | POST | /wp-admin/admin-ajax.php | - | 443 | - | ip | Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64) | https://xxx.yyy.de/wp-admin/upload.php | 200 | 0 | 0 | 726
05:34:02 | ip | POST | /wp-cron.php | doing_wp_cron | 443 | - | ip | WordPress/6.8.1;+https://xxx.yyy.de | - | 200 | 0 | 0 | 234
05:34:02 | ip | POST | /wp-admin/admin-ajax.php | - | 443 | - | ip | Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64) | https://xxx.yyy.de/wp-admin/upload.php | 200 | 0 | 0 | 568
05:35:02 | ip | POST | /wp-cron.php | doing_wp_cron | 443 | - | ip | WordPress/6.8.1;+https://xxx.yyy.de | - | 200 | 0 | 0 | 287
05:35:02 | ip | POST | /wp-admin/admin-ajax.php | - | 443 | - | ip | Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64) | https://xxx.yyy.de/wp-admin/upload.php | 200 | 0 | 0 | 606
05:36:31 | ip | POST | /wp-admin/admin-ajax.php | - | 443 | - | ip | Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64) | https://xxx.yyy.de/wp-admin/upload.php | 500 | 0 | 64 | 30003
05:37:34 | ip | POST | /wp-admin/admin-ajax.php | - | 443 | - | ip | Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64) | https://xxx.yyy.de/wp-admin/upload.php | 500 | 0 | 64 | 30025
If ModSecurity is uninstalled, the upload works.
FrankWarius commentedon Jun 12, 2025
I just tried to upload a pdf with 12 MB, Same error.
I guess, that the Windows handling of oversized uploads run into this error.
airween commentedon Jun 12, 2025
Could you check the SecRequestBodyLimit value? I know your image's size is "only" 4.6MB, but to be sure...
Btw when a client uploads a file, it converts that into BASE64 format, which has a bigger size. The multiplier is 4/3, so if your file is 1MB, the base64 encoded data will be 1.33 MB. And you should set this value (or a bit higher) as
SecRequestBodyLimit.Other question: are you able to configure debug.log in IIS? If yes, please do that, and share the debug log (in private - send it to the mail address) when you upload that file.
FrankWarius commentedon Jun 12, 2025
it's an evaluation installation "out of the 2.9.7 box" without any changes
FrankWarius commentedon Jun 12, 2025
What do you mean by iis Debug.log?
advanced logging is enabled, but there are no error logs for this site, 500 errors from other sites are logged.
do the WER reports help?
...
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.1315c7d1-9d96-4bf0-a7f9-dce5e5933d3c.tmp.dmp
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.431815de-9c66-468d-865a-95a761292e04.tmp.WERInternalMetadata.xml
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.c81ac5a9-d57c-4beb-bf84-58cdd4711110.tmp.csv
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.a89d57ec-15bd-4a27-9f34-858145c21d08.tmp.txt
...
FrankWarius commentedon Jun 12, 2025
I set advanced Logging to response code 200-999 and got only 2 log files with code 200, but no 500
airween commentedon Jun 12, 2025
May be.
Could you zip them and send it via e-mail?
FrankWarius commentedon Jun 13, 2025
sorry but the WER data of these incidents are deleted after transmission and are not archived
fzipi commentedon Oct 12, 2026
Revisiting this one. Exception code
c0000409fromucrtbase.dllis a stack buffer overrun, and @A13501350's open PR #3624 ("IIS: fix ReadFileChunk latent overflow, allocate m_dwPageSize not 1") fixes a buffer sized at one byte in the IIS module's request body reading, which is exactly where a 4.5 MB upload would trip it. Reviewing that PR is the next step; if the crash persists afterwards this needs a WER dump.ci(iis): sharpen owasp-modsecurity#3397 repro probe (WER dumps, contr…
ci(iis): add msc debug/audit logs + IIS FREB to owasp-modsecurity#3397 …
ci(iis): stand up ASP.NET body-consuming endpoint for owasp-modsecuri…
ci: match owasp-modsecurity#3397 stock config (DetectionOnly, no CRS)…
ci: run owasp-modsecurity#3397 repro on windows-2025 to match reporte…
fzipi commentedon Dec 1, 2026
Closing: #3624 (merged into
v2/master) fixes the IIS module'sReadFileChunkbuffer that was allocated with 1 byte instead of a page, which matches this stack buffer overrun on large uploads. If the crash still happens on a build that includes it, please reopen with a WER dump.Add go-ftw and 7-scenario crash check for owasp-modsecurity#3397 fix
A13501350 commentedon Dec 2, 2026
I tested this on Windows Server 2025 (GitHub Actions
windows-latest) against currentv2/master(03bbda9a, which already includes #3624), and #3397 still reproduces identically (w3wp.exe,ucrtbase.dll, exception0xc0000409, offset0x000000000001cba8).From the WER dump (
cdb.exe.ecxr; k), it is not related to #3624 (ReadFileChunkon response bodies) and is not a stack buffer overrun — it isSubcode: 0x5 FAST_FAIL_INVALID_ARG(ucrtbase!invoke_watson) triggered bywrite(msr->msc_reqbody_fd, ...)withfd = -1insidemodsecurity_request_body_store_disk():SecRuleEngine DetectionOnly,SecRequestBodyInMemoryLimit 131072,SecTmpDir c:\inetpub\temp\), IIS AppPool identities do not have write permission toC:\inetpub\tempout of the box.modsecurity_request_body_store_memory()switchesmsr->msc_reqbody_storagetoMSC_REQBODY_DISKbeforemodsecurity_request_body_start_init()fails (msc_reqbody_fd = -1).read_request_body()inapache2/apache2_io.cignoredrcbs == -1underDetectionOnlyand kept reading chunks, so the very next chunk calledmodsecurity_request_body_store_disk()->write(-1, ...)and crashedw3wp.exeinucrtbase.dll(on Linux,write(-1, ...)simply returnsEBADFinstead of crashing the process, which explains why it did not reproduce there).I have opened #3796 with a fix and verified both
go-ftwand all 7 upload/crash scenarios onwindows-latestwith zerow3wp.execrashes.