Skip to main content

4750

SUID + 750

4750 combines:

  • **SUID (4) execute as file owner
  • Owner: rwx
  • Group: r-x
  • Others: --

Result:

Only owner and group can run/read, but execution **runs with the owner's privileges (typically root).

Others have no access.

This is a **privileged script mode for internal users only, extremely rare and dangerous in a WordPress stack unless tightly controlled.

Objective

Understand when 4750 is used and how to avoid misuse in a WordPress VPS.

Concept Breakdown

Octal structure

DigitMeaning
4SUID
7Owner rwx
5Group r-x
0Others ---

Behavior

CaseOutcome
Owner runs normallyFull access
Group runs as ownerElevated
Others forbiddenNo access

Syntax Formula

Apply 4750

chmod 4750 <file>

Remove SUID

chmod u-s <file>

Verify

ls -l <file>

Permission Indicator

-rwsr-x---

Note **s in owner exec bit, no rights for others.

Practical Example & Output

Secure SUID internal script demo

echo '#!/bin/bash
id' > /usr/local/bin/privtask.sh
chown root:wpops /usr/local/bin/privtask.sh
chmod 4750 /usr/local/bin/privtask.sh
ls -l /usr/local/bin/privtask.sh

Expected:

-rwsr-x--- root wpops ... privtask.sh

If user in wpops runs:

uid=0(root) ...

Others get:

Permission denied

WordPress-Relevant Usage

ScenarioValidNotes
Admin-only privileged automation✅ Rare expert use
WP CLI, plugin scripts❌ Never
Web-accessible files❌ Severe exploit vector
SFTP shared paths❌ Misuse risk

**Rule: If you need privilege elevation use sudoers, not SUID.

WP Server Patterns

Use CaseRecommendation
Privileged maintenance tasksPrefer sudoer entry
DB backup automationRun via root cron or systemd
File repair scriptsAvoid SUID, use sudo
Shared admin ops scriptValid only if group tracked and controlled

Security Considerations

Threats

RiskReason
Privilege escalationGroup gets owner privileges
Abused by malwareHidden persistent privilege hook
Wrong group membershipUnauthorized elevation

Audit

find / -perm -4000 2>/dev/null

Hardening

chmod u-s <file>

Best Practices

PracticeReason
Never SUID WP-related scriptsBreaks isolation
Use systemd timers/cron insteadSafer
Prefer sudo policy & logsAudit trail
Limit group membership strictlyPrinciple of least privilege

WordPress Audit

Scan for SUID under /home:

find /home -perm -4000

Found?

chmod u-s <path>
chmod 750 <path>

Go-Live Checklist

Requirement
No SUID in WP directories
Privileged scripts controlled
Group membership audited
Sudoers configured

Troubleshooting Matrix

SymptomCauseFix
Users gaining root permsSUID misuseRemove SUID
WP exploit chain foundSUID file abusedReset perms + AV scan
Unexpected script privilegeWrong group owns fileCorrect chgrp

Quick Lab

Recommended secure alternative to SUID:

visudo

Add:

wpops ALL=(root) NOPASSWD:/usr/local/bin/privtask.sh

Run:

sudo /usr/local/bin/privtask.sh

Cheat Sheet

CommandPurpose
chmod 4750SUID + 750
chmod u-sRemove SUID
find / -perm -4000Scan SUID
ls -lCheck s bit

Mini-Quiz

QuestionAnswer
Meaning of 4 in 4750?SUID
Group access?Read + execute as owner
Safe in WP dirs?No
Preferred elevation method?sudoers