Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0 SCA new checks and policies #776

Merged
merged 209 commits into from Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from 207 commits
Commits
Show all changes
209 commits
Select commit Hold shift + click to select a range
7a395e9
Addition of SCA policies for RHEL 7
mikykeane Jun 12, 2020
15256dd
Addition of SCA policies for RHEL 6
mikykeane Jun 12, 2020
05730e7
Changed IDs
mikykeane Jun 12, 2020
6f9b152
Changed IDs
mikykeane Jun 12, 2020
93825fe
Recreates Centos policy based off of RHEL6
K-Embee Jun 17, 2020
f6ca5cf
Added Centos 7 SCA policies
Jun 17, 2020
85f9e31
Divided alerts into corresponding groups
mikykeane Jun 17, 2020
7ff916c
Updated IDs
mikykeane Jun 18, 2020
126a45d
Added modified CentOS files
mikykeane Jun 18, 2020
3cf5430
Merged RHEL6 L1 and L2
mikykeane Jun 23, 2020
7a1df48
Deleted old files
mikykeane Jun 23, 2020
0ee5c68
Merged RHEL 7 policies
mikykeane Jun 23, 2020
55fa1e0
Deleted unused files
mikykeane Jun 23, 2020
712eb07
Merged RHEL 8 policies
mikykeane Jun 23, 2020
b18ce56
Deleted divided policies
mikykeane Jun 23, 2020
4855677
Merged CentOS 6
mikykeane Jun 23, 2020
3ed4bee
Deleted incorrect RHEL files
mikykeane Jun 23, 2020
f6a5efb
Deleted old CentOS files
mikykeane Jun 23, 2020
93bcc35
Merged CentOS 7 policies
mikykeane Jun 23, 2020
0b28dc6
Deleted old CentOS 7 policy files
mikykeane Jun 23, 2020
6f50822
Merged CentOS 8 policies
mikykeane Jun 23, 2020
7b22629
Deleted old policies CentOS 8
mikykeane Jun 23, 2020
ac4bfd0
Updated IDs
mikykeane Jun 26, 2020
64c05d5
Update IDs
mikykeane Jun 26, 2020
2dc71a4
Update IDs
mikykeane Jun 26, 2020
c697bc8
Update IDs
mikykeane Jun 26, 2020
4d04fe6
Update IDs
mikykeane Jun 26, 2020
bc241d8
Update IDs
mikykeane Jun 26, 2020
fc30c07
Created unique Debian 9 policy
mikykeane Jun 29, 2020
7125f66
Merged Debian 9 policis into unique policy
mikykeane Jun 29, 2020
64226ce
Deleted old policy files
mikykeane Jun 29, 2020
521f355
change ids and improve 1.1.1.x checks
Jun 29, 2020
fda332b
Merged L1 and L2 of SCA into a single policy
mikykeane Jun 29, 2020
47863d4
Deleted old policies
mikykeane Jun 29, 2020
0430a21
Merged L1 and L2 into a unique Debian 8 SCA policy
mikykeane Jun 29, 2020
2ffc42f
Deleted old policy files
mikykeane Jun 29, 2020
6836d94
Fixed minor changes on section 1.1 to 1.3
Jun 30, 2020
07ade5a
Improvements from section 1.5 to 4
Jun 30, 2020
3fa1d5a
Improvements and additions
mikykeane Jun 30, 2020
b558e2d
Change umask and FileCreateMode checks
eliasgrana Jul 1, 2020
c403bb4
Fixed umask and FileCreateMode checks
eliasgrana Jul 1, 2020
93882b0
Fixed umask and FileCreateMode checks
eliasgrana Jul 1, 2020
6221603
Fixed 4.2.1.3 check
eliasgrana Jul 1, 2020
58892f2
Fixed 4.2.1.3 check
eliasgrana Jul 1, 2020
283b8c8
Improve from section 4.2 to 6.2
Jul 1, 2020
96939ec
Added SCA policy for Debian 10
mikykeane Jul 2, 2020
3ff32a7
Many changes and added a missing check
mikykeane Jul 2, 2020
02cbc43
Fixed remediations and added compliances
Jul 3, 2020
572ac0b
Improved from section 1 to 1.7
Jul 3, 2020
e00d8a7
Adapted Checks from Red Hat
mikykeane Jul 3, 2020
21d1d98
Section 1 minor touchups
K-Embee Jul 6, 2020
a5ab40b
1.4.2 fix
K-Embee Jul 6, 2020
7289617
Various section 1-2 fixes and touchups
K-Embee Jul 6, 2020
c55285b
Fixed from section 1.7 to section 4.4
Jul 6, 2020
94e347f
Merge branch '682-debian10-dev' of https://github.com/wazuh/wazuh-rul…
Jul 6, 2020
bf6e5e5
Minor changes
mikykeane Jul 6, 2020
b578df6
Changed IDs
mikykeane Jul 6, 2020
0bbee05
Changed IDs
mikykeane Jul 6, 2020
530c24a
Changed IDs
mikykeane Jul 6, 2020
ee91fec
Changed IDs
mikykeane Jul 6, 2020
639aa28
Added changed Policies
mikykeane Jul 7, 2020
c48806b
Fixed format 6.1.4
eliasgrana Jul 7, 2020
a50ed0f
Changed comment
mikykeane Jul 7, 2020
3853e43
Improvements on sections 5 and 6
eliasgrana Jul 7, 2020
b6db5d5
Adds 3.5.2.3, fixes 3.5.4.1.1's title
K-Embee Jul 7, 2020
d4fc10d
Merge branch '682-debian10-dev' of github.com:wazuh/wazuh-ruleset int…
K-Embee Jul 7, 2020
6c40bf9
Merged L1 and L2
mikykeane Jul 7, 2020
7dba82a
Fixes 5.3.2
K-Embee Jul 8, 2020
03076d1
Fixed indexing problems
Jul 8, 2020
5c8baae
Added missing checks from sections 1 to 2.3.9
Jul 8, 2020
30483d8
Changes, additions and missing things
mikykeane Jul 8, 2020
96ef1e8
Deletion of old policy files
mikykeane Jul 8, 2020
bb54718
Section 2 fixes
K-Embee Jul 9, 2020
c601f7b
Improvements from section 2.3 to 18.3
Jul 9, 2020
6555caf
Adds missing checks (18.3.1, 18.3.2)
K-Embee Jul 9, 2020
4cfe94a
Merge branch '632-win2012R2-dev' of github.com:wazuh/wazuh-ruleset in…
K-Embee Jul 9, 2020
34a966b
Improvements from section 18.3 to 18.9.24
Jul 10, 2020
7131698
Updated IDs
mikykeane Jul 10, 2020
3840a02
Onedrive fix
K-Embee Jul 13, 2020
12ddc14
Improvements from section 18.9.24 to 18.9.76
Jul 13, 2020
77c2554
Merge branch '632-win2012R2-dev' of github.com:wazuh/wazuh-ruleset in…
K-Embee Jul 13, 2020
bbe04e4
Improvements from section 18.9.24
Jul 13, 2020
47870f4
Merge branch '632-win2012R2-dev' of github.com:wazuh/wazuh-ruleset in…
K-Embee Jul 13, 2020
13727b3
Merge branch 639-dev1 policies on a file
Jul 14, 2020
09a5500
Delete Datacenter Evaluation requirement
Jul 14, 2020
5224ea7
Adds missing ID on 2.3.17.5
K-Embee Jul 14, 2020
386997b
Improvements until section 9.3.7
Jul 14, 2020
1be78f9
Merge branch '639-win2016-dev' of https://github.com/wazuh/wazuh-rule…
Jul 14, 2020
7bdcdb0
Adds missing ID on 2.3.17.5
Jul 14, 2020
f0f51ac
Added missing fixes
mikykeane Jul 14, 2020
9112b59
Merge branch '630-centos7-dev' of github.com:wazuh/wazuh-ruleset into…
mikykeane Jul 14, 2020
ea4f5de
Fixes 2.3.10.12 and 2.3.11.4
K-Embee Jul 14, 2020
1925e09
Merge branch '639-win2016-dev' of github.com:wazuh/wazuh-ruleset into…
K-Embee Jul 14, 2020
2e6df0f
Merge pull request #706 from wazuh/615-rhel7-dev
mikykeane Jul 14, 2020
d5f3f73
Merge pull request #707 from wazuh/665-rhel6-dev
mikykeane Jul 14, 2020
e24991a
Changed in title
mikykeane Jul 14, 2020
eea50ec
Merge branch '624-rhel8-dev' of github.com:wazuh/wazuh-ruleset into 6…
mikykeane Jul 14, 2020
f9db43b
Merge pull request #714 from wazuh/624-rhel8-dev
mikykeane Jul 14, 2020
af7e3e9
Merge pull request #713 from wazuh/664-centos6-dev
mikykeane Jul 14, 2020
22b3b2d
Merge pull request #715 from wazuh/630-centos7-dev
mikykeane Jul 14, 2020
2312698
Edit to title
mikykeane Jul 14, 2020
44c5eba
Deleted Centos 6 from wrong branch
mikykeane Jul 14, 2020
23e6fc9
Merge pull request #712 from wazuh/631-centos8-dev
mikykeane Jul 14, 2020
b7fe33b
Updated IDs
mikykeane Jul 14, 2020
98242a5
Merge pull request #723 from wazuh/668-debian7-dev
mikykeane Jul 14, 2020
48dd4cf
Merge pull request #724 from wazuh/672-debian8-dev
mikykeane Jul 14, 2020
c249448
Merge pull request #725 from wazuh/679-debian9-dev
mikykeane Jul 14, 2020
5f15459
Merge pull request #726 from wazuh/682-debian10-dev
mikykeane Jul 14, 2020
7c4ab06
Adds 18.2.x and 18.5.4.x
K-Embee Jul 15, 2020
b6c55f5
Various section 18 missing checks
K-Embee Jul 15, 2020
5b00c51
Adds remaining section 18 checks
K-Embee Jul 15, 2020
1f238b7
Improvements from section 18.3.2 to 18.9.58.3.10
Jul 15, 2020
38ae496
Merge branch '639-win2016-dev' of https://github.com/wazuh/wazuh-rule…
Jul 15, 2020
eddb5d3
Merge branch '639-win2016-dev' of github.com:wazuh/wazuh-ruleset into…
K-Embee Jul 15, 2020
11e46bc
Updated IDs
mikykeane Jul 15, 2020
4c07f41
Improvements on section 18.9
Jul 16, 2020
afd4568
Changes in title
mikykeane Jul 16, 2020
bd93195
Merge branch '639-win2016-dev' of github.com:wazuh/wazuh-ruleset into…
mikykeane Jul 16, 2020
f5c68a7
Merge branch '639-win2016-dev' of https://github.com/wazuh/wazuh-rule…
Jul 16, 2020
2a306c0
Fixes 18.9.58.3.10.1, 18.9.76.9.1
K-Embee Jul 16, 2020
4e7f74c
Merge branch '639-win2016-dev' of github.com:wazuh/wazuh-ruleset into…
K-Embee Jul 16, 2020
c3f2b25
Fixed typo on 2.3.11.4
eliasgrana Jul 16, 2020
fb7023f
Merge branch 656-dev1 on a single policy file
Jul 16, 2020
1a589f4
Fixed 2.3.10.12
Jul 16, 2020
0ef1f5c
Changes in title
mikykeane Jul 16, 2020
1e9aafa
Improvements from section 18.3
Jul 17, 2020
8428613
Fixes 2.3.10.6's description
K-Embee Jul 17, 2020
c35e360
Added SQL Server 2012 policy
Jul 20, 2020
41116c7
improvements on sql server 2012
Jul 20, 2020
65c4a57
Overall fixes
K-Embee Jul 20, 2020
f5c4864
Added SCA policy for SQL 2014
mikykeane Jul 20, 2020
d019894
Merge from 694-dev3
eliasgrana Jul 21, 2020
89a1987
Fixed description typos
Jul 21, 2020
7edad35
Removed 3.11 check
eliasgrana Jul 21, 2020
ad62f78
Adds SQL Server 2019
K-Embee Jul 21, 2020
49db15f
SCA description fix
K-Embee Jul 21, 2020
653660c
SCA title fix
K-Embee Jul 21, 2020
69fef09
Changed title
mikykeane Jul 21, 2020
fca950a
Eliminado 3.11 por problemas de permisos
K-Embee Jul 22, 2020
cde87ff
Deleted check 3.11
mikykeane Jul 22, 2020
2ced5fd
Clarified the description in 5.1
K-Embee Jul 22, 2020
82f0516
Fixed 2.14
K-Embee Jul 22, 2020
b906b06
Merge branch '4.0' into 4.0-SCA
mikykeane Jul 22, 2020
d67bec9
Update IDs
mikykeane Jul 22, 2020
301bde2
Update IDs
mikykeane Jul 22, 2020
9850405
Update IDs
mikykeane Jul 22, 2020
a94d849
Add new policies
mikykeane Jul 22, 2020
3dce300
Merging win10 enterprise L1 and L2
mikykeane Jul 22, 2020
68943b8
Updated IDs
mikykeane Jul 22, 2020
05d633f
Merge pull request #733 from wazuh/639-win2016-dev
mikykeane Jul 22, 2020
769af9b
Merge pull request #732 from wazuh/656-win2019-dev
mikykeane Jul 22, 2020
603180e
Merge branch '632-win2012R2-dev' into 4.0-SCA
mikykeane Jul 22, 2020
41be751
Updated all SCA IDs
mikykeane Jul 22, 2020
8cf7563
Improvements on SQL Server 2017
Jul 23, 2020
0ba32c9
Change policy description and requirements
eliasgrana Jul 23, 2020
4a43b17
Multitude of section 2, 9 and 18 fixes
K-Embee Jul 23, 2020
5d76536
Improvements until section 18.8.26
Jul 23, 2020
d905294
Merge branch '647-win10-dev' of https://github.com/wazuh/wazuh-rulese…
Jul 23, 2020
b7b4847
Fixes to remediation
mikykeane Jul 23, 2020
53be3a7
Improvements on section 5 and 18.9
Jul 24, 2020
e84f6e7
18.9.14.1 fix
K-Embee Jul 24, 2020
b7d1802
Merge branch '647-win10-dev' of github.com:wazuh/wazuh-ruleset into 6…
K-Embee Jul 24, 2020
7f220b7
5.29 missing quote
K-Embee Jul 24, 2020
cd0b300
Added missing check and updated IDs
mikykeane Jul 24, 2020
f42415c
Added comment
mikykeane Jul 24, 2020
cc78b4e
Merge pull request #734 from wazuh/647-win10-dev
mikykeane Jul 24, 2020
068ac28
Merge pull request #738 from wazuh/696-sql2019-dev
mikykeane Jul 24, 2020
5e8dbb1
Merge pull request #737 from wazuh/694-sql17-dev
mikykeane Jul 24, 2020
aa7ddbc
Merge pull request #736 from wazuh/692-sql14-dev
mikykeane Jul 24, 2020
33d4916
Merge pull request #735 from wazuh/685-sql12-dev
mikykeane Jul 24, 2020
563e4f0
Changed wrong naming
mikykeane Sep 22, 2020
c659804
centos7-1
Oct 5, 2020
7821559
centos7-2
Oct 6, 2020
1b7535c
Update branch
Oct 7, 2020
835ddc9
centos7-3
Oct 7, 2020
d066f1e
Edit SCA policies for RHEL7 - CIS 3.x
mikykeane Oct 14, 2020
6663b0c
Fixing IDs
mikykeane Oct 19, 2020
1a51061
Fixed many typos throughout SCA
Oct 19, 2020
014bbf4
Merge pull request #765 from wazuh/4.0-SCA-spellcheck
MiguelCasaresRobles Oct 19, 2020
9f05fcf
Updated fully Sections 1 and 4
mikykeane Oct 21, 2020
18fdea5
Updated IDs
mikykeane Oct 21, 2020
118f1bd
Modified section 2,3 and 6 of RHEL7-SCA
mikykeane Oct 21, 2020
dafa66e
Changed IDs
mikykeane Oct 21, 2020
c3e6754
Fixed compiling error in RHEL7 SCA
mikykeane Oct 21, 2020
ee735ea
Spell Check to RHEL 7 SCA policy
mikykeane Oct 22, 2020
73928e6
Deleted file added by mistake
mikykeane Oct 22, 2020
ff4fca8
Edited secion 5
mikykeane Oct 22, 2020
20d4da0
Adapted CentOS 7 SCA and changed RHEL 7 SCA policy
mikykeane Oct 22, 2020
3c93447
FIx to CentOS 7 SCA policy
mikykeane Oct 23, 2020
dc36de9
Merge branch '4.0-SCA' into 4.0-SCA-update
mikykeane Oct 23, 2020
6cdc917
Merge pull request #769 from wazuh/4.0-SCA-update
mikykeane Oct 26, 2020
fc14514
Fixed win10 SCA typo
mikykeane Oct 27, 2020
1677800
Fixed title mistakes
mikykeane Oct 27, 2020
8baafbd
Fixed check 1.3.2 in RHEL and CentOS 7 - SCA
mikykeane Oct 28, 2020
36bfe84
Added another install directory as a valid check for running mysql ch…
Nov 10, 2020
c42f003
Fixed typo that broke check 7036
Nov 10, 2020
21bf793
Added missing apostrophe that would break the file
Nov 10, 2020
3e477fd
Merge branch '4.0' into 4.0-SCA
Nov 10, 2020
c6c7d5d
Merge branch 'master' into 4.0-SCA
Nov 10, 2020
4550725
Fixed formatting issues
mikykeane Nov 16, 2020
2b23ae7
Uppercased Benchmark
mikykeane Nov 16, 2020
27a1304
Removed CentOS from RHEL policy
mikykeane Nov 16, 2020
bd4d41b
Fixed uppercases
mikykeane Nov 16, 2020
07a19c1
fix the after r: and remove rpm -qa command
odintree Nov 19, 2020
f2adbe5
change mistaken condition
odintree Nov 19, 2020
885b66b
Added fix to CentOS 7 - SCA
mikykeane Nov 20, 2020
eefadf6
Merge pull request #781 from wazuh/4.0-SCA-fix-rpm-qa-command
mikykeane Nov 20, 2020
baa683a
Fixed non escaped parenthesis
mikykeane Nov 20, 2020
b1344b8
Fixed typo CentOS 7 - SCA
mikykeane Nov 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 30 additions & 30 deletions sca/applications/cis_apache_24.yml

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions sca/applications/cis_mysql5-6_community.yml
Expand Up @@ -13,21 +13,22 @@
policy:
id: "cis_mysql_community"
file: "cis_mysql5-6_community.yml"
name: "CIS benchmark for Oracle MySQL Community Server 5.6"
name: "CIS Benchmark for Oracle MySQL Community Server 5.6"
description: "This document, CIS Oracle MySQL Community Server 5.6 Benchmark, provides prescriptive guidance for establishing a secure configuration posture for MySQL Community Server 5.6. This guide was tested against MySQL Community Server 5.6 running on Ubuntu Linux 14.04, but applies to other linux distributions as well."
references:
- https://www.cisecurity.org/cis-benchmarks/

requirements:
title: "Check that MySQL is installed on the system"
description: "Requirements for running the SCA scan against the MySQL policy."
condition: all
condition: any
rules:
- 'd:/etc/mysql'
- 'd:/var/lib/mysql'

checks:
#1 Operating System Level Configuration
- id: 9500
- id: 10500
title: "Disable MySQL Command History"
description: "On Linux/UNIX, the MySQL client logs statements executed interactively to a history file. By default, this file is named .mysql_history in the user's home directory. Most interactive commands run in the MySQL client application are saved to a history file. The MySQL command history should be disabled."
rationale: "Disabling the MySQL command history reduces the probability of exposing sensitive information, such as passwords and encryption keys."
Expand All @@ -42,7 +43,7 @@ checks:
- 'd:/home -> ^.mysql_history$'
- 'd:/root -> ^.mysql_history$'

- id: 9501
- id: 10501
title: "Disable Interactive Login"
description: "When created, the MySQL user may have interactive access to the operating system, which means that the MySQL user could login to the host as any other user would."
rationale: "Preventing the MySQL user from logging in interactively may reduce the impact of a compromised MySQL account. There is also more accountability as accessing the operating system where the MySQL server lies will require the user's own account. Interactive access by the MySQL user is unnecessary and should be disabled."
Expand All @@ -53,7 +54,7 @@ checks:
rules:
- 'c:getent passwd mysql -> r:/bin/false|/sbin/nologin'

- id: 9502
- id: 10502
title: "Verify That 'MYSQL_PWD' Is Not Set In Users' Profiles"
description: "MySQL can read a default database password from an environment variable called MYSQL_PWD."
rationale: "The use of the MYSQL_PWD environment variable implies the clear text storage of MySQL credentials. Avoiding this may increase assurance that the confidentiality of MySQL credentials is preserved."
Expand All @@ -67,7 +68,7 @@ checks:
- 'c:find /home -maxdepth 2 -type f -exec grep MYSQL_PWD {} + -> r:.profile|.bashrc|.bash_profile && r:$MYSQL_PWD'

#4 General
- id: 9503
- id: 10503
title: "Ensure 'allow-suspicious-udfs' Is Set to 'FALSE'"
description: "This option prevents attaching arbitrary shared library functions as user-defined functions by checking for at least one corresponding method named _init, _deinit, _reset, _clear, or _add."
rationale: "Preventing shared libraries that do not contain user-defined functions from loading will reduce the attack surface of the server."
Expand All @@ -81,7 +82,7 @@ checks:
rules:
- 'c:my_print_defaults mysqld -> r:allow-suspicious-udfs'

- id: 9504
- id: 10504
title: "Ensure 'local_infile' is Disabled"
description: "The 'local_infile' parameter dictates whether files located on the MySQL client's computer can be loaded or selected via 'LOAD DATA INFILE' or 'SELECT local_file'."
rationale: "Disabling 'local_infile' reduces an attacker's ability to read sensitive files off the affected server via a SQL injection vulnerability."
Expand All @@ -95,7 +96,7 @@ checks:
rules:
- 'c:grep -Rh local-infile /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:local-infile\s*=\s*0'

- id: 9505
- id: 10505
title: "Ensure 'mysqld' Is Not Started with '--skip-grant-tables'"
description: "This option causes mysqld to start without using the privilege system."
rationale: "If this option is used, all clients of the affected server will have unrestricted access to all databases."
Expand All @@ -108,11 +109,11 @@ checks:
rules:
- 'c:grep -Rh skip-grant-tables /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:skip-grant-tables\s*=\s*FALSE|skip-grant-tables\s*=\s*false'

- id: 9506
- id: 10506
title: "Ensure '--skip-symbolic-links' Is Enabled"
description: "The symbolic-links and skip-symbolic-links options for MySQL determine whether symbolic link support is available. When use of symbolic links are enabled, they have different effects depending on the host platform. When symbolic links are disabled, then symbolic links stored in files or entries in tables are not used by the database. "
rationale: "Prevents sym links being used for data base files. This is especially important when MySQL is executing as root as arbitrary files may be overwritten. The symbolic-links option might allow someone to direct actions by to MySQL server to other files and/or directories."
remediation: "Open the MySQL configuration file (my.cnf), locate 'skip_symbolic_links' and set it to YES. If the option does not existe, create it in the 'mysqld' section."
remediation: "Open the MySQL configuration file (my.cnf), locate 'skip_symbolic_links' and set it to YES. If the option does not exist, create it in the 'mysqld' section."
compliance:
- cis: ["4.6"]
references:
Expand All @@ -122,7 +123,7 @@ checks:
rules:
- 'c:grep -Rh skip_symbolic_links /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:skip_symbolic_links\s*=\s*YES|skip_symbolic_links\s*=\s*yes'

- id: 9507
- id: 10507
title: "Ensure 'secure_file_priv' is not empty"
description: "The secure_file_priv option restricts to paths used by LOAD DATA INFILE or SELECT local_file. It is recommended that this option be set to a file system location that contains only resources expected to be loaded by MySQL."
rationale: "Setting secure_file_priv reduces an attacker's ability to read sensitive files off the affected server via a SQL injection vulnerability. "
Expand All @@ -135,7 +136,7 @@ checks:
rules:
- 'c:grep -Rh secure_file_priv /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:secure_file_priv\s*=\s*\.'

- id: 9508
- id: 10508
title: "Ensure 'sql_mode' Contains 'STRICT_ALL_TABLES'"
description: "When data changing statements are made (i.e. INSERT, UPDATE), MySQL can handle invalid or missing values differently depending on whether strict SQL mode is enabled. When strict SQL mode is enabled, data may not be truncated or otherwise 'adjusted' to make the data changing statement work."
rationale: "Without strict mode the server tries to do proceed with the action when an error might have been a more secure choice. For example, by default MySQL will truncate data if it does not fit in a field, which can lead to unknown behavior, or be leveraged by an attacker to circumvent data validation. "
Expand All @@ -147,10 +148,10 @@ checks:
- 'c:grep -Rh strict_all_tables /etc/mysql/my.cnf /etc/mysql/my.ini /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:strict_all_tables'

#6 Auditing and Logging
- id: 9509
- id: 10509
title: "Ensure 'log_error' is not empty"
description: "The error log contains information about events such as mysqld starting and stopping, when a table needs to be checked or repaired, and, depending on the host operating system, stack traces when mysqld fails"
rationale: "nabling error logging may increase the ability to detect malicious attempts against MySQL, and other critical messages, such as if the error log is not enabled then connection error might go unnoticed."
rationale: "Enabling error logging may increase the ability to detect malicious attempts against MySQL, and other critical messages, such as if the error log is not enabled then connection error might go unnoticed."
remediation: "Set the log-error option to the path for the error log in the MySQL configuration file (my.cnf or my.ini)."
compliance:
- cis: ["6.1"]
Expand All @@ -160,7 +161,7 @@ checks:
rules:
- 'c:grep -Rh log_error /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:log_error\s*=\s*\S+\s*'

- id: 9510
- id: 10510
title: "Ensure Log Files are not Stored on a non-system partition"
description: "MySQL log files can be set in the MySQL configuration to exist anywhere on the filesystem. It is common practice to ensure that the system filesystem is left uncluttered by application logs. System filesystems include the root, /var, or /usr."
rationale: "Moving the MySQL logs off the system partition will reduce the probability of denial of service via the exhaustion of available disk space to the operating system."
Expand All @@ -174,7 +175,7 @@ checks:
rules:
- 'c:grep -Rh log_bin /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:log_bin\s*\t*/+$|log_bin\s*\t*/+var/*$|log_bin\s*\t*/+usr/*$'

- id: 9511
- id: 10511
title: "Ensure 'log_warning' is set to 2"
description: "The log_warnings system variable, enabled by default, provides additional information to the MySQL log. A value of 1 enables logging of warning messages, and higher integer values tend to enable more logging."
rationale: "This might help to detect malicious behavior by logging communication errors and aborted connections."
Expand All @@ -187,7 +188,7 @@ checks:
rules:
- 'c:grep -Rh log_warnings /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> !r:^\s*\t*# && r:log_warnings\s*=\s*2'

- id: 9512
- id: 10512
title: "Ensure 'log_raw' is set to 'OFF'"
description: "The log-raw MySQL option determines whether passwords are rewritten by the server so as not to appear in log files as plain text. If log-raw is enabled, then passwords are written to the various log files (general query log, slow query log, and binary log) in plain text. "
rationale: "With raw logging of passwords enabled someone with access to the log files might see plain text passwords."
Expand All @@ -202,7 +203,7 @@ checks:
- 'c:grep -Rh log-raw /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> !r:^\s*\t*# && r:log-raw\s*OFF$|log-raw\s*off$'

#7 Authentication
- id: 9513
- id: 10513
title: "Ensure 'old_passwords' Is Not Set to '1' or 'ON'"
description: "This variable controls the password hashing method used by the PASSWORD() function and for the IDENTIFIED BY clause of the CREATE USER and GRANT statements. Before 5.6.6, the value can be 0 (or OFF), or 1 (or ON). As of 5.6.6, the following value can be one of the following: 0 - authenticate with the mysql_native_password plugin; 1 - authenticate with the mysql_old_password plugin; 2 - authenticate with the sha256_password plugin"
rationale: "The mysql_old_password plugin leverages an algorithm that can be quickly brute forced using an offline dictionary attack. See CVE-2003-1480 for additional details."
Expand All @@ -219,7 +220,7 @@ checks:
- 'c:grep -Rh old_passwords /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> !r:^\s*\t*# && r:old_passwords\s*=\s*1'
- 'c:grep -Rh old_passwords /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> !r:^\s*\t*# && r:old_passwords\s*=\s*ON|old_passwords\s*=\s*on'

- id: 9514
- id: 10514
title: "Ensure 'secure_auth' is set to 'ON'"
description: "This option dictates whether the server will deny connections by clients that attempt to use accounts that have their password stored in the mysql_old_password format."
rationale: "Enabling this option will prevent all use of passwords employing the old format (and hence insecure communication over the network)."
Expand All @@ -232,7 +233,7 @@ checks:
rules:
- 'c:grep -Rh secure_auth /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:secure_auth\s*=\s*ON|secure_auth\s*=\s*on'

- id: 9515
- id: 10515
title: "Ensure Passwords Are Not Stored in the Global Configuration"
description: "The [client] section of the MySQL configuration file allows setting a user and password to be used. Verify the password option is not used in the global configuration file (my.cnf)."
rationale: "The use of the password parameter may negatively impact the confidentiality of the user's password."
Expand All @@ -245,7 +246,7 @@ checks:
rules:
- 'c:grep -Rh password /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> !r:^\s*\t*# && r:^\s*password\.*'

- id: 9516
- id: 10516
title: "Ensure 'sql_mode' Contains 'NO_AUTO_CREATE_USER'"
description: "NO_AUTO_CREATE_USER is an option for sql_mode that prevents a GRANT statement from automatically creating a user when authentication information is not provided."
rationale: "Blank passwords negate the benefits provided by authentication mechanisms. Without this setting an administrative user might accidentally create a user without a password."
Expand All @@ -256,7 +257,7 @@ checks:
rules:
- 'c:grep -Rh no_auto_create_user /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> !r:^\s*\t*# && r:\s*no_auto_create_user\s*$'

- id: 9517
- id: 10517
title: "Ensure Password Policy is in Place"
description: "Password complexity includes password characteristics such as length, case, length, and character sets."
rationale: "Complex passwords help mitigate dictionary, brute forcing, and other password attacks. This recommendation prevents users from choosing weak passwords which can easily be guessed."
Expand All @@ -276,8 +277,8 @@ checks:
- 'c:grep -Rh validate_password_policy /etc/mysql/my.cnf /etc/mysql/mariadb.cnf /etc/mysql/conf.d /etc/mysql/mariadb.conf.d -> r:validate_password_policy\s*=\s*MEDIUM\s*|validate_password_policy\s*=\s*STRONG\s*|validate_password_policy\s*=\s*medium\s*|validate_password_policy\s*=\s*strong\s*'

#9 Replication
- id: 9518
title: "Ensure 'master_info_repositrory' is set to 'TABLE'"
- id: 10518
title: "Ensure 'master_info_repository' is set to 'TABLE'"
description: "The master_info_repository setting determines to where a slave logs master status and connection information. The options are FILE or TABLE. Note also that this setting is associated with the sync_master_info setting as well."
rationale: "The password which the client uses is stored in the master info repository, which by default is a plaintext file. The TABLE master info repository is a bit safer, but with filesystem access it's still possible to gain access to the password the slave is using."
remediation: "Open the MySQL configuration file (my.cnf); locate master_info_repository; set the master_info_repository value to TABLE. Add the option if it does not exist."
Expand Down