File & Execution Protection

File & Execution Protection

Uploads PHP Execution Protection

What This Does

This protection prevents PHP files from executing within the WordPress uploads directory.

It ensures that any uploaded files cannot be used to run code on your server.


Why It Matters

The uploads directory is writable by WordPress.

If an attacker is able to upload a malicious PHP file, they may be able to execute it and gain control of your site.

Blocking PHP execution in this directory removes a common attack vector.


When to Apply It

This protection is recommended for most WordPress sites.

Apply it when:


When Not to Apply It

Do not apply this protection if:

If unsure, apply cautiously and test your site.


How Steel Security Applies This

Steel Security applies this protection by modifying server behavior.

Depending on your environment, this may include:

These rules prevent PHP files from executing within the uploads directory.


What to Expect After Applying

After applying this protection:


How to Verify

To verify the protection:

  1. Attempt to access a PHP file within the uploads directory
  2. Confirm that execution is blocked

You may see:


How to Revert (Rollback)

To revert this protection:

  1. Navigate to the hardening section in Steel Security
  2. Disable the control
  3. Confirm the change
  4. Test your site functionality

The uploads directory will return to its previous behavior.


Common Issues

File Downloads Instead of Executing

This is expected behavior.

Execution is being blocked as intended.


Plugin Stops Working

Some plugins may rely on executing PHP in uploads.

If this occurs:


Block Direct PHP Access

What This Does

This protection prevents direct access to PHP files that are not intended to be accessed via a browser.

It ensures that internal scripts cannot be executed outside of normal WordPress workflows.


Why It Matters

Many PHP files within a WordPress site are meant to be included internally, not accessed directly.

If these files are accessible, attackers may:

Blocking direct access reduces this risk.


When to Apply It

This protection is recommended for most production websites.

Apply it when:


When to Be Cautious

Be cautious when:

Test thoroughly after applying.


How Steel Security Applies This

Steel Security restricts direct access to PHP files using server-level rules.

This may include:

The exact implementation depends on your server environment.


What to Expect After Applying

After applying this protection:


How to Verify

To verify the protection:

  1. Attempt to access a PHP file directly via URL
  2. Confirm that access is denied (e.g., 403 Forbidden)

Ensure:


How to Revert (Rollback)

To revert this protection:

  1. Navigate to the hardening section in Steel Security
  2. Disable or adjust the control
  3. Confirm the change
  4. re-test affected functionality

Common Issues

Legitimate Script Access Is Blocked

This may occur if:

To resolve:


No Change Observed


Best Practices


Prevent Execution in Sensitive Directories

What This Does

This protection prevents PHP execution within directories that should only store data, not executable code.

It helps ensure that uploaded or stored files cannot be used to run malicious scripts.


Why It Matters

Certain directories are intended for storage, such as:

If PHP execution is allowed in these locations, attackers may:

Blocking execution in these directories significantly reduces this risk.


When to Apply It

This protection is strongly recommended for all production websites.

Apply it when:


When to Be Cautious

Be cautious when:

Always test after applying.


How Steel Security Applies This

Steel Security applies server-level rules to prevent PHP execution in sensitive directories.

This may include:

The exact implementation depends on your server environment.


What to Expect After Applying

After applying this protection:


How to Verify

To verify the protection:

  1. Upload or place a test PHP file in a protected directory
  2. attempt to access it via browser
  3. confirm that execution is blocked

Expected results include:


How to Revert (Rollback)

To revert this protection:

  1. Navigate to the hardening section in Steel Security
  2. disable or adjust the control
  3. confirm the change
  4. re-test directory behavior

Common Issues

Uploaded Files Do Not Behave as Expected


No Visible Change

This is expected if:


Rule Not Applied


Best Practices