If you care about security you should not install themes and plugins from the wordpress admin. Either install them by uploading via FTP or use WP-CLI for that.
There is just no way to change file owners when the script is running in the context of the web server, therefor the only way to maintain reasonable file permissions is to avoid uploading code from the admin.
Related Posts:
- Avoid ‘uploads’ 777 permissions: Potential threat or clean solution?
- File and directory permissions
- How to get WordPress to save upload file beyond web root [closed]
- Securing a multi-user permission structure
- Is it good security advice to install wordpress in subdirectory but link to root?
- What permissions should I give directories if I want to make WordPress more secure?
- Definitive wordpress directory ownership and permissions on linux
- How to change permissions of WordPress and/or apache on macOS securely?
- Are there security risks in working directly in the themes folder that builds into a theme folder?
- On new server, site got hacked, permissions a bit strange? Please help
- Privilege escalation bugs in 2.9?
- Monitor wordpress all external calls
- Why are the latest visits to my website originating from my own website?
- Moved WordPress to other folder (Windows) WAMP = 403 Forbidden
- Should I change the default file and folder permissions?
- Folder Permissions + Security Concerns
- Malware/Permission bug removal?
- Default installation permissions for wp-config.php
- Directory to store secure file
- How to solve “Kernel panic – not syncing – Attempted to kill init” — without erasing any user data
- What’s the best approach for generating a new API key?
- Is it possible to decrypt SHA1
- How to change permissions for a folder and its subfolders/files in one step
- Simplest two-way encryption using PHP
- How does the SQL injection from the “Bobby Tables” XKCD comic work?
- Error `sec_error_revoked_certificate` when viewed in Firefox only
- Convert .pfx to .cer
- how fix “this certificate cannot be verified up to a trusted certification authority”
- cd into directory without having permission
- Getting a List of Currently Available Roles on a WordPress Site?
- Why should I use the esc_url?
- How safe / sanitized is wp_insert_posts()?
- From a security standpoint, should bloginfo() or get_bloginfo() be escaped?
- Where to securely store API keys and passwords in WordPress?
- What are the recommended database permissions for WordPress?
- Full path disclosure on rss-functions.php
- What to use instead of wp_kses() in user output
- Are the default salts secure?
- Is there a way to force ssl on certain pages
- Subscribe to email for security fixes?
- How to escape custom css?
- Understanding SVG vulnerabilities in WordPress related to a specific fix
- How to secure or disable the RSS feeds?
- Regular security checks – what steps should be included?
- What are the pros and cons of using a custom front-end to retrieve content from a WordPress back-end
- Do Cookies Need to be Sanatized Before Being Saved?
- Disable external access to REST API Endpoint
- Make password invalid once logged out of password-protected page
- Do you need to escape hard coded plain text?
- Encrypt emails?
- WordPress salts set in config and database
- Disallow file edit not preventing plugin install
- How to secure WordPress XMLRPC?
- Protecting HTML5 video [closed]
- Does WP show me if I’m logged in from multiple locations?
- Do I need to use the esc_html() function on hard coded links?
- Frontend Password change
- Restrictive File Permissions
- Downloading File from Outside Web Root
- site get login attempts after htaccess ip restriction
- wp-config.php modified?
- Moving wp-config.php up 2 levels
- How Could I sanitize the receive data from this code
- WordPress SQL Injections through User Agent
- How to prevent wp-login brute force attack from thousand of different IP? [duplicate]
- Evaluations of two wordpress security plans against php code injection attack
- How to protect wp-admin through .htaccess?
- Something is unescaping all html entities before output to browser [closed]
- Is wp_kses the right approach in sanitizing this string?
- Renaming install.php for security?
- Limit Login Attempts BEFORE PHP is executed?
- Safe to say WordPress security releases don’t have database upgrades
- Use global variables or function that returns said variables for site-wide private-ish WP settings?
- fail2ban to prevent Brute Force Attacks on WordPress?
- Use Google authentication for pages within a website [closed]
- How to give the same error message when the wrong password or wrong username is used?
- should I escape a literal url added in functions.php
- Access sub-domain when root public_html is protected with .htaccess password
- Moving wp-config.php outside root folder where we have multiple wordpress websites for enhanced security [duplicate]
- Adding Security Keys?
- How might I sanitize an XML file before WP Import? (Does wordpress verify or clean text when importing from an XML document? )
- What highest security brake with wordpress and static files?
- Secret keys in SCM
- Uploading attachment (pdf) and prevent download for anonymous user
- Specific Page/Post Need to Stay Non SSL
- Scan multiple websites for malware that are in same webhost root?
- Security: AWS (shared hosting) claims template file malicious
- Cannot access wp admin of WordPress website (security plugin issue) [closed]
- PHP Code Sniffer – WordPress VIP Coding Standards
- wp-config.php file and code injection
- Permission functions within wordpress
- Trying to understand nature of hacking
- Problem with permissions in wp-content/plugins
- FORCE_SSL_ADMIN affecting subdomains
- What is the best security $_POST method?
- Is my WP site being hacked?
- How do you search for backdoors from the previous IT person?
- How to test if my server is vulnerable to the ShellShock bug?
- Is wp-cron.php vulnerable to external attacks and how to protect it?
- How to address security vulnerabilities: LUCKY13, BEAST, and BREACH