403 Forbidden on Upload: Why Media Uploads Get Blocked

403 Forbidden on Upload: Why Media Uploads Get Blocked

Written by

in

Lab-tested: Local lab server (Python 3.13.5, nginx-style log format) · 2 Dec 2026 · Reproduced and fixed in our lab

Fix Box — Try this first (10 seconds)

Upload a small JPG. If that also returns 403, the uploads folder is not writable — fix its permission to 755. If only certain file types fail, a WAF rule is filtering the upload.

The log line tells you which. Our 403 pillar guide maps every layer, and the 403 Checker helps you confirm the result.

Two upload blocks, two different fixes

A 403 during upload means the server refused the file before WordPress stored it. The refusal happens at one of two layers.

Either the server process cannot write to the uploads folder, or a firewall rule dislikes the request.

The two causes need opposite fixes. Permissions need a chmod. A WAF rule needs an exception or a narrower rule. Guessing wrong wastes time and can weaken security.

Cause 1: uploads folder not writable

WordPress writes media into wp-content/uploads/. The web server user needs write access to that folder tree.

If permissions were tightened to 000 or ownership changed to root, every upload fails at once.

The error log shows a permission line naming the uploads path. That line is the fingerprint of this cause.

Cause 2: WAF rule on the upload request

Firewalls inspect upload requests for dangerous content. A rule that blocks .php files in uploads is good security.

Trouble starts when the rule also matches harmless names, double extensions, or scanner-like patterns inside images.

In that case a JPG may upload fine while a renamed file fails. The log shows a WAF rule ID instead of a permission error.

Not a 403: the size limit

An oversized file is a different problem. Servers answer 413 Payload Too Large, or WordPress shows its own size message.

If you see 403, size is not your cause, whatever the file weighs.

Our lab test

We reproduced both causes on a local lab server on 2 Dec 2026. A baseline upload POST returned 200.

We then set the uploads folder permission to 000 and uploaded again.

The response was 403, and the log named the folder:

2026/12/02 [error] open() "/tmp/lab403broot/wp-content/uploads/file" failed (13: Permission denied), client: 127.0.0.1, server: lab403b, request: "POST /wp-admin/async-upload.php"

Restoring 755 brought uploads back to 200. We then enabled a WAF rule blocking .php uploads.

A shell.php upload returned 403 with the rule ID in the log, while photo.jpg still returned 200.

Step-by-step fix

First, reproduce with a small JPG and note the time. Then read the server error log for that minute. The log line decides your path.

For a permission line, fix the uploads tree. Set folders to 755 and files to 644, and make sure the web server user owns or can write the uploads folder.

Test one upload again.

For a WAF rule line, find the rule in your firewall or Cloudflare Security Events. Narrow it to the dangerous pattern only, or add an exception for your admin path and IP.

Never disable upload scanning entirely just to make one file pass.

If uploads fail for everyone on every file type, also check the .htaccess guide — a deny rule inside uploads blocks writes too.

The WordPress 403 guide covers the plugin layer above.

What Did Not Work

Raising the upload size limit changed nothing in our test. The requests never reached the size check. They died at the permission and WAF layers first.

Setting the uploads folder to 777 “to be sure” also missed the point. It fixed the permission case but left the WAF case untouched, and it left the folder world-writable.

755 with the right owner is the correct target.

Prevention

Keep uploads at 755 with the web server as owner. Review WAF upload rules after every false alarm, and keep them scoped to executable extensions.

After any host migration, upload one test image before you need it for real work.

FAQ

Frequently Asked Questions

Why do only some file types fail?

That pattern points to a WAF rule, not permissions. Permission failures block every type equally. Check the log for a rule ID.

Is 777 on uploads safe?

No. World-writable upload folders are a classic malware foothold. Use 755 and correct ownership instead.

My upload worked yesterday. What changed?

Usually a host update, a security plugin update, or a permission “cleanup”. Compare the first failure time with recent changes. The log line names the layer that changed.

Does a 403 on upload affect existing media?

No. Existing files keep serving normally. Only new writes are refused.

Sources and date

Lab test: 2 Dec 2026, local lab server on our SI machine (Python 3.13.5 emitting nginx-style log lines; client IP is localhost).

The chmod values and the .php WAF trigger below are the exact actions measured.

Tested actions:

# Permission fix (tested)
chmod 755 wp-content/uploads
# WAF trigger (tested): POST async-upload.php with file=shell.php -> 403
# Same request with file=photo.jpg -> 200

References

  • RFC 9110 §15.5.3 — 403 Forbidden: https://www.rfc-editor.org/rfc/rfc9110.html
  • MDN Web Docs — 403 Forbidden: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403
  • WordPress.org — Hardening WordPress (file permissions): https://wordpress.org/documentation/article/hardening-wordpress/
  • Cloudflare WAF — Overview: https://developers.cloudflare.com/waf/

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


More posts