The cross-account symlink attack on shared hosting is old and well-understood: account A creates a symlink to account B’s wp-config.php, then has Apache serve it. cPanel ships a patched Apache that refuses to follow a symlink whose owner does not match the directory’s owner. The protection breaks a handful of legitimate workflows — symlinking a shared static-assets directory across vhosts — but the breakage is the protection working. Turning it off to fix one ticket is rarely the right call.
What’s happening
Options +FollowSymLinks tells Apache to follow symlinks anywhere; Options +SymLinksIfOwnerMatch tells Apache to follow a symlink only if the symlink’s owner matches the target file’s owner. cPanel’s EasyApache 4 ships with an additional patch (the “Jail” or “SymlinkProtection” patch depending on year) that enforces ownership-matching at a deeper level, even when FollowSymLinks is set. The combination prevents a customer with shell access from symlinking out of their own home into another customer’s tree and reading the target via HTTP.
How to verify
Confirm the protection is engaged:
apachectl -V | grep -i "symlink"
grep -r "SymLinksIfOwnerMatch\|FollowSymLinks" /etc/apache2/conf.d/userdata/ 2>/dev/null | head
rpm -qa | grep ea-apache24 | grep -i jail
grep -r "Options" /home/<user>/public_html/.htaccess 2>/dev/null
If apachectl -V shows a custom string about symlink protection, the EA4 patch is in.
The fix
- The default cPanel configuration ships with
SymLinksIfOwnerMatchenforced. Confirm this is still the case for the affected vhost:apachectl -t -D DUMP_INCLUDES | grep -B2 -A5 example.com | grep -i symlink. - If a customer’s legitimate workflow is broken by the protection (they symlink a shared assets directory across two of their own vhosts), the fix is to make both ends of the symlink owned by the same user. If both vhosts belong to the same cPanel user, the symlink works. If they belong to different cPanel users (sub-account), you have to either move both to one cPanel user or duplicate the assets.
- If the customer’s app needs to follow symlinks owned by different users (rare, usually a build system that pulls from
/opt/something), the right answer is not to disable the protection but to copy the files into the customer’s tree. - For server-level workflows (your own
/var/www/error-pagesfor the global custom-error setup), the directive that loosens the protection should be scoped to that one directory, not the whole vhost. Use<Directory "/var/www/error-pages"> Options +FollowSymLinks </Directory>rather than touching the customer’s docroot. - Never set
+FollowSymLinks -SymLinksIfOwnerMatchon a customer vhost as a workaround for a ticket. The next security audit will catch it; the next attacker will exploit it. - Document any per-vhost symlink override against a workload reason. Quarterly, audit
apachectl -t -D DUMP_INCLUDES | grep -i symlinkand confirm every loosening is still justified.
For environments where shared-hosting isolation is part of compliance posture, Stack Harbor preserves the default symlink protection and reviews every override under managed cPanel operations.