A default SilverStripe deployment is reasonably careful about what it exposes, but the gap between a working install and a hardened one is wide once the site lives on a shared LiteSpeed server. The framework relies on a correctly configured web root, a set of protected directories, and application-level settings that many site owners never touch after the initial setup. When those pieces are left at their defaults, an attacker gains several cheap footholds: readable configuration fragments, a well-known login URL to brute-force, framework version strings that advertise known CVEs, and an admin area reachable over plain HTTP. None of these require a kernel exploit or root access to abuse, which means none of them require root access to fix either. Everything below is achievable from an unprivileged cPanel or DirectAdmin account using File Manager, .htaccess, .user.ini, and the SilverStripe admin dashboard.
The first thing to understand is how SilverStripe lays out its files. Modern SilverStripe (CMS 4 and 5) uses a public/ directory as the document root. Everything sensitive — vendor/, app/ (or the legacy mysite/), .env, composer.json, and the framework code itself — sits one level above public/ and should never be web-accessible. On shared hosting the risk appears when the account's document root is pointed at the SilverStripe project root instead of public/, or when an older CMS 3-style flat layout is in use. In either case, requests like /vendor/, /.env, or /app/_config.php can leak secrets. Confirming and correcting the document root, then layering protective rules on top, is where hardening begins.
Set the correct document root and lock down file permissions
Open cPanel and go to Domains (Jupiter theme) or, in DirectAdmin, Domain Setup. Check the document root for your domain. For a CMS 4/5 install it must point to the public subdirectory, for example /home/youruser/silverstripe/public, not /home/youruser/silverstripe. If it currently points at the project root, change it so only public/ is served. This single change removes direct web access to vendor/, .env, and your application config in one move. If you cannot repoint the root because other content lives there, you must instead rely on .htaccess rules (covered below) to block those paths.
Next, correct file permissions through the File Manager. SilverStripe does not need world-writable files, and anything set to 777 on shared hosting is a liability because other processes on the server can potentially write to it. Use File Manager → Permissions and apply these values: directories 0755, PHP and config files 0644. The .env file, which holds your database credentials and SS_ secrets, should be 0600 so only your account's PHP process can read it. Never set 0777 on any directory; if an upload or cache write fails, 0755 with correct ownership is almost always sufficient on CloudLinux because your files already run as your user.
The public/assets/ directory needs to be writable for uploads, but it must not execute PHP. Create or edit public/assets/.htaccess and ensure uploaded scripts can never run:
<FilesMatch "\.(php|php5|php7|php8|phtml|pht|cgi|pl)$">
Require all denied
</FilesMatch>
<IfModule mod_mime.c>
RemoveHandler .php .phtml .php5 .php7 .php8
RemoveType .php .phtml .php5 .php7 .php8
</IfModule>This neutralizes the classic attack where a malicious file is uploaded through a form and then requested directly to gain code execution. SilverStripe stores legitimate uploads here, but it never needs to execute PHP from the assets tree.
Block sensitive paths and framework fingerprinting
Even with the document root pointed at public/, add defensive rules to the root .htaccess (located in public/.htaccess — SilverStripe already ships one, so append rather than overwrite). The goal is to deny anything that should never be fetched directly and to stop the server from advertising what it runs. Add the following near the top of public/.htaccess, inside the existing structure:
# Deny dotfiles and sensitive extensions
<FilesMatch "(\.env|\.ini|\.log|\.sql|\.yml|\.yaml|composer\.(json|lock))$">
Require all denied
</FilesMatch>
RedirectMatch 404 /\.git
RedirectMatch 404 /vendor/
RedirectMatch 404 /\.envIf your document root could not be moved to public/, these rules become essential rather than belt-and-braces, since they are the only thing stopping /vendor/ and /.env from loading. Test each path in a browser after saving: a request to https://yourdomain/.env should return 403 or 404, never the file contents.
SilverStripe also benefits from suppressing version disclosure. Make sure debug and error details are off in production. In your .env (editable from File Manager), set SS_ENVIRONMENT_TYPE="live". In live mode, the framework hides stack traces and version banners, so a 500 error no longer reveals your module versions to a probing scanner. Pair this with proper logging rather than on-screen errors; if you are still seeing white screens or need to inspect faults safely, the companion walkthrough on debug mode and logging covers the correct approach without exposing diagnostics to visitors.
Protect the admin path and strengthen authentication
The SilverStripe backend lives at /admin by default, and that predictability is what makes it a brute-force target. You cannot easily rename the route from an unprivileged account without editing module config, but you can place a second authentication layer in front of it. Use cPanel's Directory Privacy (or DirectAdmin's Password Protected Directories) is awkward here because /admin is a virtual route handled by index.php, not a real folder. Instead, enforce HTTP Basic Auth through .htaccess scoped to the admin URL. First create a password file outside the web root using File Manager, for example /home/youruser/.htpasswd-admin, then add to public/.htaccess:
<If "%{REQUEST_URI} =~ m#^/admin#">
AuthType Basic
AuthName "Restricted"
AuthUserFile "/home/youruser/.htpasswd-admin"
Require valid-user
</If>Generate the .htpasswd hash with cPanel's Directory Privacy tool on a throwaway folder, copy the resulting line, then paste it into your chosen file. This forces attackers to defeat a server-level prompt before SilverStripe's own login even loads, which stops automated credential-stuffing cold.
Inside the CMS, open Security in the admin menu and audit accounts. Remove stale administrator logins, ensure every account uses a long unique password, and install or enable the official silverstripe/mfa and silverstripe/totp-authenticator modules if your build includes them so staff can enroll TOTP second factors. Also confirm the default admin account created during install has been renamed or given a strong password — the SS_DEFAULT_ADMIN_USERNAME and SS_DEFAULT_ADMIN_PASSWORD entries in .env should be removed entirely once a real administrator exists, because leaving them active creates a hardcoded backdoor login.
Enforce HTTPS and HTTP security headers
The final layer is transport and browser-side protection, all of which you can set in public/.htaccess. Force every request onto HTTPS so the admin login and session cookies are never transmitted in clear text:
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]Then add response headers that harden the browser session:
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Content-Security-Policy "frame-ancestors 'self'"
Header unset X-Powered-By
Header unset Server
</IfModule>HSTS keeps browsers from downgrading to HTTP, X-Frame-Options and the CSP frame-ancestors directive block clickjacking of the admin, and X-Content-Type-Options stops MIME sniffing of uploaded content. Removing X-Powered-By strips the PHP version from responses. On LiteSpeed these mod_headers directives are honored natively, so no additional module is required.
Validate your work with a browser's developer tools network tab: load the homepage and confirm the headers appear on the response, then request /admin and confirm the HTTP Basic prompt fires before the SilverStripe login. Re-check .env permissions at 0600 and confirm /vendor/ returns an error. With the document root corrected, uploads unable to execute, the backend gated by a second credential, and the browser protected by HSTS and anti-framing headers, a stock SilverStripe install moves from exposed to genuinely hardened without a single command requiring root.