Am I affected by MrbMiner malware?
SQL Server hardware can be powerful. Lots of CPU cores and memory. Just what a crypto miner may need in their quest to generate cryptocurrency. In the case of the MrbMiner exploit, numerous SQL Servers have been exploited with brute-force attacks. These attacks are scanning for servers exposed directly to the internet and are using weak passwords. Once exploited, a new account, using the username “Default” is created. An app is downloaded which begins mining Monero cryptocurrency. More details on the exploit can be found here.
Checking for the “Default” username
You can check for the presence of this login by running the query below. If found, a full network audit is recommended.
--Verify the default account doesn't exist. No results is a good thing.
SELECT
[name],
[type_desc],
is_disabled,
create_date,
modify_date
FROM sys.server_principals
WHERE [name] = 'Default'
What if you already had a login named “Default”? Determine if the password was recently changed to “@fg125kjnhn987” and if there have been any recent login failures. Review for any recently created logins as well. Are all logins accounted for? Were any created that you were not aware of? If so, review each further to determine what permissions they have and identify what they’re being used for.
--Review recently created logins
SELECT
[name],
[type_desc],
is_disabled,
create_date,
modify_date
FROM sys.server_principals
ORDER BY create_date desc
Review recently modified logins.
--Review recently modified logins
SELECT
[name],
[type_desc],
is_disabled,
create_date,
modify_date
FROM sys.server_principals
ORDER BY modify_date desc
Avoid making your SQL Servers easy targets
By utilizing security best practices, most brute-force attacks can be stopped. Or, at the very least, set off alarm bells and whistles to alert you of suspicious activity. Below is a list of do’s and don’ts we typically recommend. This is not an exhaustive list.
Don’t
- Don’t expose your SQL Servers to the internet (if at all possible). Use a VPN to access externally.
- Don’t use weak passwords (for any account).
- Don’t add your SQL Server service accounts to the local admin group.
- Don’t grant your SQL Server service accounts more permissions than required.
- Don’t grant logins more permissions than required.
- Don’t install additional services which are not required. SQL Server licenses include not only the database engine, but integration services, analysis services, and reporting services as well (at the time of this post). It’s easy enough to go ahead and install these additional services but also increases the attack surface area. Only install what is required.
- Don’t enable additional options, within SQL Server, if unneeded. For example, xp_cmdshell, Ole Automation Procedures, and ad hoc distributed queries.
Do
- Patch often. Review latest cumulative update, service pack releases, and hotfixes. Start here.
- Implement a policy in which an account will become locked out after X number of attempts.
- Change passwords often.
- Audit the creation of new logins (and review the audits often 😉).
- Disable the SA account. This account is well known and has unfettered access.
- If not required, don’t use SQL Server authentication.
- Review failed login attempts. Especially those occurring numerous times within a short span of time. This could be an indication of a brute-force attempt.
- Implement a process to audit using guidelines such as the US government Security Technical Implementation Guides (STIGs) or Center for Internet Security (more on these below).
- Review the health and performance metrics of your SQL Servers regularly.
- Proactively monitor your SQL Servers to look for unexpected deviations of resource consumption.
Audit your environment
These types of exploits can typically be avoided. Implementing good security practices can be a painful process (not only from a technical perspective but also from the staff and end user perspective). The following guides provide a large set of information and scripts to get you started with securing your environment.
CIS – Center for Internet Security
CIS Benchmarks are consensus-developed secure configuration guidelines for hardening. There are benchmarks for operating systems, server software, cloud providers, network devices etc. Take a look here for a list of what they have to offer. SQL Server specific benchmarks can be found at https://www.cisecurity.org/benchmark/microsoft_sql_server/. There are some aspects of the site which requires membership but includes additional tools. Well worth the consideration.
National Vulnerability Database
The NCP is the U.S. government repository of publicly available security checklists which provide guidance on setting the security configuration of operating systems and applications. The checklists (STIG) can be downloaded as a zip. To view, download and install the STIG Viewer from https://public.cyber.mil/stigs/srg-stig-tools/ and follow the instructions.
How we can help
Security is constantly evolving. Setting up good policies around platform hardening, password complexity and rotation, and using accounts with the least privilege required is a daunting task for any organization. Especially those without dedicated security or database administrators. I’m hopeful a few of the resources above can get you started on the right path. We’re here to help as well. If you’d like assistance in assessing your SQL Servers, schedule a call with us here.
Thanks for reading!
One Response
[…] a profitable, albeit illegal, business model for many. And SQL Server-specific attacks, such as MrbMiner and Vollgar, have been found in the […]