Blog | G5 Cyber Security

Hide Admin Account in Database

TL;DR

Yes, you can make it harder for attackers to find your admin account by not using a predictable username like ‘admin’. However, this is security through obscurity and shouldn’t be your only defence. Strong passwords, multi-factor authentication, and regular security audits are far more important.

How to Conceal Your Admin Account

  1. Don’t use ‘admin’ or similar usernames: This is the most basic step. Attackers will always try common names first.
    • Choose a unique, random username for your admin account.
    • Avoid anything related to your application name or team members.
  2. Hash storage is key: You should never store passwords in plain text.
    • Use a strong hashing algorithm like bcrypt, Argon2, or scrypt. These are designed to be slow and make brute-force attacks more difficult.
    • Always use salts with your hashes. A salt is a random string added to each password before hashing. This prevents rainbow table attacks.
  3. Obfuscate the username field (with caution): You can try to make it harder to identify the admin account by obfuscating how usernames are stored.
    • Example: Store a hash of the username instead of the username itself. This means you’d compare the hash of the entered username with the stored hash, not the username directly.
    -- Example SQL (PostgreSQL) - NOT production ready!  Illustrative only.
    CREATE TABLE users (
        id SERIAL PRIMARY KEY,
        username_hash VARCHAR(255) NOT NULL,
        password_hash VARCHAR(255) NOT NULL
    );
    
    -- When a user logs in:
    SELECT password_hash FROM users WHERE username_hash = SHA256('entered_username');
  4. Important: This adds complexity and can make account recovery difficult. Ensure you have robust processes for handling lost credentials if you go this route.
  5. Role-Based Access Control (RBAC): Implement RBAC instead of relying solely on an ‘admin’ account.
    • Create different roles with specific permissions (e.g., ‘administrator’, ‘editor’, ‘viewer’).
    • Assign users to these roles. An administrator role would have all privileges.
    • This way, even if an attacker compromises an account, they’ll only have the permissions associated with that role.
  6. Limit database access: Restrict which accounts can access your database.
    • Use the principle of least privilege – grant each application component only the necessary permissions to function.
    • Don’t use a single ‘root’ or ‘admin’ database account for all applications.
  7. Regular Security Audits: Regularly review your code and infrastructure for vulnerabilities.
    • Penetration testing can help identify weaknesses in your security posture.
    • Keep your software up to date with the latest security patches.

Important Considerations

Concealing your admin account is not a substitute for strong security practices. Attackers can still find ways to identify it, such as:

Focus on these core security measures:

Exit mobile version