diff --git a/ReviewParser.js b/ReviewParser.js index ff17a33..c3cd531 100644 --- a/ReviewParser.js +++ b/ReviewParser.js @@ -290,7 +290,10 @@ export function reviewsFromCkl( let ruleId vuln.STIG_DATA.some(stigDatum => { if (stigDatum.VULN_ATTRIBUTE == "Rule_ID") { - ruleId = stigDatum.ATTRIBUTE_DATA + if (!stigDatum.ATTRIBUTE_DATA) { + return false + } + ruleId = stigDatum.ATTRIBUTE_DATA.endsWith('_rule') ? stigDatum.ATTRIBUTE_DATA : stigDatum.ATTRIBUTE_DATA + '_rule' return true } }) @@ -906,8 +909,9 @@ export function reviewsFromCklb( function generateReview(rule, evalStigResultEngine) { let result = resultMap[rule.status] if (!result) return - const ruleId = rule.rule_id_src + let ruleId = rule.rule_id_src ?? rule.rule_id if (!ruleId) return + ruleId = ruleId.endsWith('_rule') ? ruleId : ruleId + '_rule' const hasComments = !!rule.finding_details || !!rule.comments diff --git a/WATCHER-test-files/WATCHER/ckl/has-suffix_rule.ckl b/WATCHER-test-files/WATCHER/ckl/has-suffix_rule.ckl new file mode 100644 index 0000000..31dcc56 --- /dev/null +++ b/WATCHER-test-files/WATCHER/ckl/has-suffix_rule.ckl @@ -0,0 +1,190 @@ + + + + + None + Computing + aasfsefsefe + + + + + + + false + + + + + + + + version + 1 + + + classification + UNCLASSIFIED + + + customname + + + + stigid + CAN_Ubuntu_18-04_STIG + + + description + + + + releaseinfo + Release: 11 Benchmark Date: 27 Apr 2023 + + + title + Canonical Ubuntu 18.04 LTS Security Technical Implementation Guide + + + uuid + ea415ef5-b2ad-4dd8-914d-3eb1e0080e78 + + + notice + terms-of-use + + + source + Unknown + + + + + + Rule_ID + SV-219147r802349_rule + + + Rule_Ver + UBTU-18-010000 + + + Rule_Title + Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes. + + + Vuln_Discuss + To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems (e.g., web servers and web portals) must be properly configured to incorporate access control methods that do not rely solely on the possession of a certificate for access. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement. + +Access control policies include: identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include: access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system. + + + IA_Controls + + + + Check_Content + Verify that an encrypted root password is set. This is only applicable on systems that use a basic Input/Output System BIOS. + +Run the following command to verify the encrypted password is set: +$ grep –i password /boot/grub/grub.cfg + +password_pbkdf2 root grub.pbkdf2.sha512.10000.MFU48934NJA87HF8NSD34493GDHF84NG + +If the root password entry does not begin with “password_pbkdf2”, this is a finding. + + + Fix_Text + Configure the system to require a password for authentication upon booting into single-user and maintenance modes. + +Generate an encrypted (grub) password for root with the following command: +$ grub-mkpasswd-pbkdf2 +Enter Password: +Reenter Password: +PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.MFU48934NJD84NF8NSD39993JDHF84NG + +Using the hash from the output, modify the "/etc/grub.d/40_custom" file with the following command to add a boot password: +$ sudo sed -i '$i set superusers=\"root\"\npassword_pbkdf2 root <hash>' /etc/grub.d/40_custom + +where <hash> is the hash generated by grub-mkpasswd-pbdkf2 command. + +Configure grub to only require a password when accessing the bootloader: +$ sudo sed -i -E 's/^CLASS="[^"]*/& --unrestricted/' /etc/grub.d/10_linux + +Generate an updated "grub.conf" file with the new password by using the following command: +$ update-grub + + + False_Positives + + + + False_Negatives + + + + Documentable + false + + + Mitigations + + + + Potential_Impact + + + + Third_Party_Tools + + + + Mitigation_Control + + + + Responsibility + + + + Security_Override_Guidance + + + + Check_Content_Ref + M + + + Weight + 10.0 + + + Class + Unclassified + + + STIG_UUID + b0e43528-a14f-40ef-9cdc-595910c9a835 + + + LEGACY_ID + V-100519 + + + LEGACY_ID + SV-109623 + + + CCI_REF + CCI-000213 + + Not_Reviewed + Comment + + + + + + + \ No newline at end of file diff --git a/WATCHER-test-files/WATCHER/ckl/no-suffix_rule.ckl b/WATCHER-test-files/WATCHER/ckl/no-suffix_rule.ckl new file mode 100644 index 0000000..4a67e3b --- /dev/null +++ b/WATCHER-test-files/WATCHER/ckl/no-suffix_rule.ckl @@ -0,0 +1,190 @@ + + + + + None + Computing + aasfsefsefe + + + + + + + false + + + + + + + + version + 1 + + + classification + UNCLASSIFIED + + + customname + + + + stigid + CAN_Ubuntu_18-04_STIG + + + description + + + + releaseinfo + Release: 11 Benchmark Date: 27 Apr 2023 + + + title + Canonical Ubuntu 18.04 LTS Security Technical Implementation Guide + + + uuid + ea415ef5-b2ad-4dd8-914d-3eb1e0080e78 + + + notice + terms-of-use + + + source + Unknown + + + + + + Rule_ID + SV-219147r802349 + + + Rule_Ver + UBTU-18-010000 + + + Rule_Title + Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes. + + + Vuln_Discuss + To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems (e.g., web servers and web portals) must be properly configured to incorporate access control methods that do not rely solely on the possession of a certificate for access. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement. + +Access control policies include: identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include: access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system. + + + IA_Controls + + + + Check_Content + Verify that an encrypted root password is set. This is only applicable on systems that use a basic Input/Output System BIOS. + +Run the following command to verify the encrypted password is set: +$ grep –i password /boot/grub/grub.cfg + +password_pbkdf2 root grub.pbkdf2.sha512.10000.MFU48934NJA87HF8NSD34493GDHF84NG + +If the root password entry does not begin with “password_pbkdf2”, this is a finding. + + + Fix_Text + Configure the system to require a password for authentication upon booting into single-user and maintenance modes. + +Generate an encrypted (grub) password for root with the following command: +$ grub-mkpasswd-pbkdf2 +Enter Password: +Reenter Password: +PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.MFU48934NJD84NF8NSD39993JDHF84NG + +Using the hash from the output, modify the "/etc/grub.d/40_custom" file with the following command to add a boot password: +$ sudo sed -i '$i set superusers=\"root\"\npassword_pbkdf2 root <hash>' /etc/grub.d/40_custom + +where <hash> is the hash generated by grub-mkpasswd-pbdkf2 command. + +Configure grub to only require a password when accessing the bootloader: +$ sudo sed -i -E 's/^CLASS="[^"]*/& --unrestricted/' /etc/grub.d/10_linux + +Generate an updated "grub.conf" file with the new password by using the following command: +$ update-grub + + + False_Positives + + + + False_Negatives + + + + Documentable + false + + + Mitigations + + + + Potential_Impact + + + + Third_Party_Tools + + + + Mitigation_Control + + + + Responsibility + + + + Security_Override_Guidance + + + + Check_Content_Ref + M + + + Weight + 10.0 + + + Class + Unclassified + + + STIG_UUID + b0e43528-a14f-40ef-9cdc-595910c9a835 + + + LEGACY_ID + V-100519 + + + LEGACY_ID + SV-109623 + + + CCI_REF + CCI-000213 + + Not_Reviewed + Comment + + + + + + + \ No newline at end of file diff --git a/WATCHER-test-files/WATCHER/ckl/vuln_attribute-no-Attribute_data.ckl b/WATCHER-test-files/WATCHER/ckl/vuln_attribute-no-Attribute_data.ckl new file mode 100644 index 0000000..44ae14f --- /dev/null +++ b/WATCHER-test-files/WATCHER/ckl/vuln_attribute-no-Attribute_data.ckl @@ -0,0 +1,190 @@ + + + + + None + Computing + aasfsefsefe + + + + + + + false + + + + + + + + version + 1 + + + classification + UNCLASSIFIED + + + customname + + + + stigid + CAN_Ubuntu_18-04_STIG + + + description + + + + releaseinfo + Release: 11 Benchmark Date: 27 Apr 2023 + + + title + Canonical Ubuntu 18.04 LTS Security Technical Implementation Guide + + + uuid + ea415ef5-b2ad-4dd8-914d-3eb1e0080e78 + + + notice + terms-of-use + + + source + Unknown + + + + + + Rule_ID + + + + Rule_Ver + UBTU-18-010000 + + + Rule_Title + Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes. + + + Vuln_Discuss + To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems (e.g., web servers and web portals) must be properly configured to incorporate access control methods that do not rely solely on the possession of a certificate for access. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement. + +Access control policies include: identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include: access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system. + + + IA_Controls + + + + Check_Content + Verify that an encrypted root password is set. This is only applicable on systems that use a basic Input/Output System BIOS. + +Run the following command to verify the encrypted password is set: +$ grep –i password /boot/grub/grub.cfg + +password_pbkdf2 root grub.pbkdf2.sha512.10000.MFU48934NJA87HF8NSD34493GDHF84NG + +If the root password entry does not begin with “password_pbkdf2”, this is a finding. + + + Fix_Text + Configure the system to require a password for authentication upon booting into single-user and maintenance modes. + +Generate an encrypted (grub) password for root with the following command: +$ grub-mkpasswd-pbkdf2 +Enter Password: +Reenter Password: +PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.MFU48934NJD84NF8NSD39993JDHF84NG + +Using the hash from the output, modify the "/etc/grub.d/40_custom" file with the following command to add a boot password: +$ sudo sed -i '$i set superusers=\"root\"\npassword_pbkdf2 root <hash>' /etc/grub.d/40_custom + +where <hash> is the hash generated by grub-mkpasswd-pbdkf2 command. + +Configure grub to only require a password when accessing the bootloader: +$ sudo sed -i -E 's/^CLASS="[^"]*/& --unrestricted/' /etc/grub.d/10_linux + +Generate an updated "grub.conf" file with the new password by using the following command: +$ update-grub + + + False_Positives + + + + False_Negatives + + + + Documentable + false + + + Mitigations + + + + Potential_Impact + + + + Third_Party_Tools + + + + Mitigation_Control + + + + Responsibility + + + + Security_Override_Guidance + + + + Check_Content_Ref + M + + + Weight + 10.0 + + + Class + Unclassified + + + STIG_UUID + b0e43528-a14f-40ef-9cdc-595910c9a835 + + + LEGACY_ID + V-100519 + + + LEGACY_ID + SV-109623 + + + CCI_REF + CCI-000213 + + Not_Reviewed + Comment + + + + + + + \ No newline at end of file diff --git a/WATCHER-test-files/WATCHER/ckl/vuln_attribute-no-Rule_ID.ckl b/WATCHER-test-files/WATCHER/ckl/vuln_attribute-no-Rule_ID.ckl new file mode 100644 index 0000000..b08b840 --- /dev/null +++ b/WATCHER-test-files/WATCHER/ckl/vuln_attribute-no-Rule_ID.ckl @@ -0,0 +1,190 @@ + + + + + None + Computing + aasfsefsefe + + + + + + + false + + + + + + + + version + 1 + + + classification + UNCLASSIFIED + + + customname + + + + stigid + CAN_Ubuntu_18-04_STIG + + + description + + + + releaseinfo + Release: 11 Benchmark Date: 27 Apr 2023 + + + title + Canonical Ubuntu 18.04 LTS Security Technical Implementation Guide + + + uuid + ea415ef5-b2ad-4dd8-914d-3eb1e0080e78 + + + notice + terms-of-use + + + source + Unknown + + + + + + NOTRule_ID + SV-219147r802349_rule + + + Rule_Ver + UBTU-18-010000 + + + Rule_Title + Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes. + + + Vuln_Discuss + To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems (e.g., web servers and web portals) must be properly configured to incorporate access control methods that do not rely solely on the possession of a certificate for access. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement. + +Access control policies include: identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include: access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system. + + + IA_Controls + + + + Check_Content + Verify that an encrypted root password is set. This is only applicable on systems that use a basic Input/Output System BIOS. + +Run the following command to verify the encrypted password is set: +$ grep –i password /boot/grub/grub.cfg + +password_pbkdf2 root grub.pbkdf2.sha512.10000.MFU48934NJA87HF8NSD34493GDHF84NG + +If the root password entry does not begin with “password_pbkdf2”, this is a finding. + + + Fix_Text + Configure the system to require a password for authentication upon booting into single-user and maintenance modes. + +Generate an encrypted (grub) password for root with the following command: +$ grub-mkpasswd-pbkdf2 +Enter Password: +Reenter Password: +PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.MFU48934NJD84NF8NSD39993JDHF84NG + +Using the hash from the output, modify the "/etc/grub.d/40_custom" file with the following command to add a boot password: +$ sudo sed -i '$i set superusers=\"root\"\npassword_pbkdf2 root <hash>' /etc/grub.d/40_custom + +where <hash> is the hash generated by grub-mkpasswd-pbdkf2 command. + +Configure grub to only require a password when accessing the bootloader: +$ sudo sed -i -E 's/^CLASS="[^"]*/& --unrestricted/' /etc/grub.d/10_linux + +Generate an updated "grub.conf" file with the new password by using the following command: +$ update-grub + + + False_Positives + + + + False_Negatives + + + + Documentable + false + + + Mitigations + + + + Potential_Impact + + + + Third_Party_Tools + + + + Mitigation_Control + + + + Responsibility + + + + Security_Override_Guidance + + + + Check_Content_Ref + M + + + Weight + 10.0 + + + Class + Unclassified + + + STIG_UUID + b0e43528-a14f-40ef-9cdc-595910c9a835 + + + LEGACY_ID + V-100519 + + + LEGACY_ID + SV-109623 + + + CCI_REF + CCI-000213 + + Not_Reviewed + Comment + + + + + + + \ No newline at end of file diff --git a/WATCHER-test-files/WATCHER/cklb/has_suffix_rule.cklb b/WATCHER-test-files/WATCHER/cklb/has_suffix_rule.cklb new file mode 100644 index 0000000..9ae813c --- /dev/null +++ b/WATCHER-test-files/WATCHER/cklb/has_suffix_rule.cklb @@ -0,0 +1,87 @@ +{ + "title": "no-suffix_rule", + "id": "09482c7f-d975-4930-80a0-d863e5bd04ad", + "stigs": [ + { + "stig_name": "Canonical Ubuntu 18.04 LTS Security Technical Implementation Guide", + "display_name": "Canonical Ubuntu 18.04 LTS", + "stig_id": "CAN_Ubuntu_18-04_STIG", + "release_info": "Release: 11 Benchmark Date: 27 Apr 2023", + "uuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "reference_identifier": "4055", + "size": 177, + "rules": [ + { + "uuid": "fcbc6913-8989-4657-937f-72acf7f9a6e3", + "stig_uuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "target_key": null, + "stig_ref": null, + "group_id": "V-219147", + "rule_id": "SV-219147r802349_rule", + "rule_id_src": "SV-219147r802349_rule", + "weight": "10.0", + "classification": "Unclassified", + "severity": "high", + "rule_version": "UBTU-18-010000", + "group_title": "Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes.", + "rule_title": "Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes.", + "fix_text": "Configure the system to require a password for authentication upon booting into single-user and maintenance modes.\n\nGenerate an encrypted (grub) password for root with the following command:\n$ grub-mkpasswd-pbkdf2\nEnter Password:\nReenter Password:\nPBKDF2 hash of your password is grub.pbkdf2.sha512.10000.MFU48934NJD84NF8NSD39993JDHF84NG\n\nUsing the hash from the output, modify the \"/etc/grub.d/40_custom\" file with the following command to add a boot password:\n$ sudo sed -i '$i set superusers=\\\"root\\\"\\npassword_pbkdf2 root ' /etc/grub.d/40_custom\n\nwhere is the hash generated by grub-mkpasswd-pbdkf2 command.\n\nConfigure grub to only require a password when accessing the bootloader:\n$ sudo sed -i -E 's/^CLASS=\"[^\"]*/& --unrestricted/' /etc/grub.d/10_linux\n\nGenerate an updated \"grub.conf\" file with the new password by using the following command:\n$ update-grub", + "false_positives": "", + "false_negatives": "", + "discussion": "To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems (e.g., web servers and web portals) must be properly configured to incorporate access control methods that do not rely solely on the possession of a certificate for access. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement.\n\nAccess control policies include: identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include: access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system.", + "check_content": "Verify that an encrypted root password is set. This is only applicable on systems that use a basic Input/Output System BIOS.\n\nRun the following command to verify the encrypted password is set:\n$ grep –i password /boot/grub/grub.cfg\n\npassword_pbkdf2 root grub.pbkdf2.sha512.10000.MFU48934NJA87HF8NSD34493GDHF84NG\n\nIf the root password entry does not begin with “password_pbkdf2”, this is a finding.", + "documentable": "false", + "mitigations": "", + "potential_impacts": "", + "third_party_tools": "", + "mitigation_control": "", + "responsibility": "", + "security_override_guidance": "", + "ia_controls": "", + "check_content_ref": { + "href": "Canonical_Ubuntu_18.04_LTS_STIG.xml", + "name": "M" + }, + "legacy_ids": [ + "V-100519", + "SV-109623" + ], + "ccis": [ + "CCI-000213" + ], + "group_tree": [ + { + "id": "V-219147", + "title": "SRG-OS-000080-GPOS-00048", + "description": "" + } + ], + "createdAt": "2023-08-09T17:45:55.806Z", + "updatedAt": "2023-08-09T17:45:55.806Z", + "STIGUuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "status": "not_reviewed", + "overrides": {}, + "comments": "", + "finding_details": "" + } + ] + } + ], + "active": false, + "mode": 2, + "has_path": true, + "target_data": { + "target_type": "Computing", + "host_name": "sadfsafdsdfsdsdf", + "ip_address": "", + "mac_address": "", + "fqdn": "", + "comments": "", + "role": "None", + "is_web_database": false, + "technology_area": "", + "web_db_site": "", + "web_db_instance": "" + } + } + \ No newline at end of file diff --git a/WATCHER-test-files/WATCHER/cklb/no-Rule_ID.cklb b/WATCHER-test-files/WATCHER/cklb/no-Rule_ID.cklb new file mode 100644 index 0000000..f3875d2 --- /dev/null +++ b/WATCHER-test-files/WATCHER/cklb/no-Rule_ID.cklb @@ -0,0 +1,85 @@ +{ + "title": "no-suffix_rule", + "id": "09482c7f-d975-4930-80a0-d863e5bd04ad", + "stigs": [ + { + "stig_name": "Canonical Ubuntu 18.04 LTS Security Technical Implementation Guide", + "display_name": "Canonical Ubuntu 18.04 LTS", + "stig_id": "CAN_Ubuntu_18-04_STIG", + "release_info": "Release: 11 Benchmark Date: 27 Apr 2023", + "uuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "reference_identifier": "4055", + "size": 177, + "rules": [ + { + "uuid": "fcbc6913-8989-4657-937f-72acf7f9a6e3", + "stig_uuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "target_key": null, + "stig_ref": null, + "group_id": "V-219147", + "weight": "10.0", + "classification": "Unclassified", + "severity": "high", + "rule_version": "UBTU-18-010000", + "group_title": "Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes.", + "rule_title": "Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes.", + "fix_text": "Configure the system to require a password for authentication upon booting into single-user and maintenance modes.\n\nGenerate an encrypted (grub) password for root with the following command:\n$ grub-mkpasswd-pbkdf2\nEnter Password:\nReenter Password:\nPBKDF2 hash of your password is grub.pbkdf2.sha512.10000.MFU48934NJD84NF8NSD39993JDHF84NG\n\nUsing the hash from the output, modify the \"/etc/grub.d/40_custom\" file with the following command to add a boot password:\n$ sudo sed -i '$i set superusers=\\\"root\\\"\\npassword_pbkdf2 root ' /etc/grub.d/40_custom\n\nwhere is the hash generated by grub-mkpasswd-pbdkf2 command.\n\nConfigure grub to only require a password when accessing the bootloader:\n$ sudo sed -i -E 's/^CLASS=\"[^\"]*/& --unrestricted/' /etc/grub.d/10_linux\n\nGenerate an updated \"grub.conf\" file with the new password by using the following command:\n$ update-grub", + "false_positives": "", + "false_negatives": "", + "discussion": "To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems (e.g., web servers and web portals) must be properly configured to incorporate access control methods that do not rely solely on the possession of a certificate for access. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement.\n\nAccess control policies include: identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include: access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system.", + "check_content": "Verify that an encrypted root password is set. This is only applicable on systems that use a basic Input/Output System BIOS.\n\nRun the following command to verify the encrypted password is set:\n$ grep –i password /boot/grub/grub.cfg\n\npassword_pbkdf2 root grub.pbkdf2.sha512.10000.MFU48934NJA87HF8NSD34493GDHF84NG\n\nIf the root password entry does not begin with “password_pbkdf2”, this is a finding.", + "documentable": "false", + "mitigations": "", + "potential_impacts": "", + "third_party_tools": "", + "mitigation_control": "", + "responsibility": "", + "security_override_guidance": "", + "ia_controls": "", + "check_content_ref": { + "href": "Canonical_Ubuntu_18.04_LTS_STIG.xml", + "name": "M" + }, + "legacy_ids": [ + "V-100519", + "SV-109623" + ], + "ccis": [ + "CCI-000213" + ], + "group_tree": [ + { + "id": "V-219147", + "title": "SRG-OS-000080-GPOS-00048", + "description": "" + } + ], + "createdAt": "2023-08-09T17:45:55.806Z", + "updatedAt": "2023-08-09T17:45:55.806Z", + "STIGUuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "status": "not_reviewed", + "overrides": {}, + "comments": "", + "finding_details": "" + } + ] + } + ], + "active": false, + "mode": 2, + "has_path": true, + "target_data": { + "target_type": "Computing", + "host_name": "sadfsafdsdfsdsdf", + "ip_address": "", + "mac_address": "", + "fqdn": "", + "comments": "", + "role": "None", + "is_web_database": false, + "technology_area": "", + "web_db_site": "", + "web_db_instance": "" + } + } + \ No newline at end of file diff --git a/WATCHER-test-files/WATCHER/cklb/no-rule_id_src.cklb b/WATCHER-test-files/WATCHER/cklb/no-rule_id_src.cklb new file mode 100644 index 0000000..b45ea7e --- /dev/null +++ b/WATCHER-test-files/WATCHER/cklb/no-rule_id_src.cklb @@ -0,0 +1,77 @@ +{ + "title": "Imported Checklist", + "id": "58903b74-235b-42ac-b1ee-8c801a6f7432", + "active": true, + "mode": 2, + "has_path": false, + "target_data": { + "target_type": "Computing", + "host_name": "aasfsefsefe", + "ip_address": "", + "mac_address": "", + "fqdn": "", + "comments": "", + "role": "None", + "is_web_database": false, + "technology_area": "", + "web_db_site": "", + "web_db_instance": "" + }, + "stigs": [ + { + "stig_name": "Canonical Ubuntu 18.04 LTS Security Technical Implementation Guide", + "display_name": "Canonical Ubuntu 18.04 LTS", + "stig_id": "CAN_Ubuntu_18-04_STIG", + "release_info": "Release: 11 Benchmark Date: 27 Apr 2023", + "uuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "size": 177, + "rules": [ + { + "group_id": "V-219147", + "severity": "high", + "group_title": "Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes.", + "rule_id_src": "SV-219147r802349_rule", + "rule_version": "UBTU-18-010000", + "rule_title": "Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes.", + "discussion": "To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems (e.g., web servers and web portals) must be properly configured to incorporate access control methods that do not rely solely on the possession of a certificate for access. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement.\n\nAccess control policies include: identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include: access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system.", + "ia_controls": "", + "check_content": "Verify that an encrypted root password is set. This is only applicable on systems that use a basic Input/Output System BIOS.\n\nRun the following command to verify the encrypted password is set:\n$ grep –i password /boot/grub/grub.cfg\n\npassword_pbkdf2 root grub.pbkdf2.sha512.10000.MFU48934NJA87HF8NSD34493GDHF84NG\n\nIf the root password entry does not begin with “password_pbkdf2”, this is a finding.", + "fix_text": "Configure the system to require a password for authentication upon booting into single-user and maintenance modes.\n\nGenerate an encrypted (grub) password for root with the following command:\n$ grub-mkpasswd-pbkdf2\nEnter Password:\nReenter Password:\nPBKDF2 hash of your password is grub.pbkdf2.sha512.10000.MFU48934NJD84NF8NSD39993JDHF84NG\n\nUsing the hash from the output, modify the \"/etc/grub.d/40_custom\" file with the following command to add a boot password:\n$ sudo sed -i '$i set superusers=\\\"root\\\"\\npassword_pbkdf2 root ' /etc/grub.d/40_custom\n\nwhere is the hash generated by grub-mkpasswd-pbdkf2 command.\n\nConfigure grub to only require a password when accessing the bootloader:\n$ sudo sed -i -E 's/^CLASS=\"[^\"]*/& --unrestricted/' /etc/grub.d/10_linux\n\nGenerate an updated \"grub.conf\" file with the new password by using the following command:\n$ update-grub", + "false_positives": "", + "false_negatives": "", + "documentable": "false", + "mitigations": "", + "potential_impacts": "", + "third_party_tools": "", + "mitigation_control": "", + "responsibility": "", + "security_override_guidance": "", + "check_content_ref": { + "name": "M", + "href": "" + }, + "weight": "10.0", + "classification": "Unclassified", + "legacy_ids": [ + "V-100519", + "SV-109623" + ], + "ccis": [ + "CCI-000213" + ], + "stig_ref": [], + "target_key": [], + "stig_uuid": [ + "7c52357f-ba9e-4829-9460-ea9b13f7e8d1" + ], + "uuid": "99e2a76f-d1a9-4c07-8b08-10df60407968", + "comments": "", + "finding_details": "", + "group_tree": [], + "status": "not_reviewed", + "overrides": {} + } + ] + } + ] +} \ No newline at end of file diff --git a/WATCHER-test-files/WATCHER/cklb/no-suffix_rule.cklb b/WATCHER-test-files/WATCHER/cklb/no-suffix_rule.cklb new file mode 100644 index 0000000..e622a0a --- /dev/null +++ b/WATCHER-test-files/WATCHER/cklb/no-suffix_rule.cklb @@ -0,0 +1,86 @@ +{ + "title": "no-suffix_rule", + "id": "09482c7f-d975-4930-80a0-d863e5bd04ad", + "stigs": [ + { + "stig_name": "Canonical Ubuntu 18.04 LTS Security Technical Implementation Guide", + "display_name": "Canonical Ubuntu 18.04 LTS", + "stig_id": "CAN_Ubuntu_18-04_STIG", + "release_info": "Release: 11 Benchmark Date: 27 Apr 2023", + "uuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "reference_identifier": "4055", + "size": 177, + "rules": [ + { + "uuid": "fcbc6913-8989-4657-937f-72acf7f9a6e3", + "stig_uuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "target_key": null, + "stig_ref": null, + "group_id": "V-219147", + "rule_id": "SV-219147r802349", + "rule_id_src": "SV-219147r802349", + "weight": "10.0", + "classification": "Unclassified", + "severity": "high", + "rule_version": "UBTU-18-010000", + "group_title": "Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes.", + "rule_title": "Ubuntu operating systems booted with a BIOS must require authentication upon booting into single-user and maintenance modes.", + "fix_text": "Configure the system to require a password for authentication upon booting into single-user and maintenance modes.\n\nGenerate an encrypted (grub) password for root with the following command:\n$ grub-mkpasswd-pbkdf2\nEnter Password:\nReenter Password:\nPBKDF2 hash of your password is grub.pbkdf2.sha512.10000.MFU48934NJD84NF8NSD39993JDHF84NG\n\nUsing the hash from the output, modify the \"/etc/grub.d/40_custom\" file with the following command to add a boot password:\n$ sudo sed -i '$i set superusers=\\\"root\\\"\\npassword_pbkdf2 root ' /etc/grub.d/40_custom\n\nwhere is the hash generated by grub-mkpasswd-pbdkf2 command.\n\nConfigure grub to only require a password when accessing the bootloader:\n$ sudo sed -i -E 's/^CLASS=\"[^\"]*/& --unrestricted/' /etc/grub.d/10_linux\n\nGenerate an updated \"grub.conf\" file with the new password by using the following command:\n$ update-grub", + "false_positives": "", + "false_negatives": "", + "discussion": "To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems (e.g., web servers and web portals) must be properly configured to incorporate access control methods that do not rely solely on the possession of a certificate for access. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement.\n\nAccess control policies include: identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include: access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system.", + "check_content": "Verify that an encrypted root password is set. This is only applicable on systems that use a basic Input/Output System BIOS.\n\nRun the following command to verify the encrypted password is set:\n$ grep –i password /boot/grub/grub.cfg\n\npassword_pbkdf2 root grub.pbkdf2.sha512.10000.MFU48934NJA87HF8NSD34493GDHF84NG\n\nIf the root password entry does not begin with “password_pbkdf2”, this is a finding.", + "documentable": "false", + "mitigations": "", + "potential_impacts": "", + "third_party_tools": "", + "mitigation_control": "", + "responsibility": "", + "security_override_guidance": "", + "ia_controls": "", + "check_content_ref": { + "href": "Canonical_Ubuntu_18.04_LTS_STIG.xml", + "name": "M" + }, + "legacy_ids": [ + "V-100519", + "SV-109623" + ], + "ccis": [ + "CCI-000213" + ], + "group_tree": [ + { + "id": "V-219147", + "title": "SRG-OS-000080-GPOS-00048", + "description": "" + } + ], + "createdAt": "2023-08-09T17:45:55.806Z", + "updatedAt": "2023-08-09T17:45:55.806Z", + "STIGUuid": "ea415ef5-b2ad-4dd8-914d-3eb1e0080e78", + "status": "not_reviewed", + "overrides": {}, + "comments": "", + "finding_details": "" + } + ] + } + ], + "active": false, + "mode": 2, + "has_path": true, + "target_data": { + "target_type": "Computing", + "host_name": "sadfsafdsdfsdsdf", + "ip_address": "", + "mac_address": "", + "fqdn": "", + "comments": "", + "role": "None", + "is_web_database": false, + "technology_area": "", + "web_db_site": "", + "web_db_instance": "" + } +} diff --git a/test/ckl-tests/CKLStigViewerRuleId.test.js b/test/ckl-tests/CKLStigViewerRuleId.test.js new file mode 100644 index 0000000..040c163 --- /dev/null +++ b/test/ckl-tests/CKLStigViewerRuleId.test.js @@ -0,0 +1,157 @@ +import chai from 'chai' +import { reviewsFromCkl } from '../../ReviewParser.js' +import fs from 'fs/promises' +const expect = chai.expect + +// Create a helper function to read the file and generate the review object +async function generateReviewObject ( + filePath, + importOptions, + fieldSettings, + allowAccept +) { + const data = await fs.readFile(filePath, 'utf8') + return reviewsFromCkl({ + data, + importOptions, + fieldSettings, + allowAccept + }) +} + +describe('CKL StigViewer 3.2 ruleID ', () => { + it('Should Append _rule to the files ruleId', async () => { + const importOptions = { + autoStatus: 'submitted', + unreviewed: 'commented', + unreviewedCommented: 'informational', + emptyDetail: 'import', + emptyComment: 'import', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', // not used + required: 'always' + }, + comment: { + enabled: 'findings', // not used + required: 'optional' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/ckl/no-suffix_rule.ckl' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + + expect(review.checklists[0].reviews[0].ruleId).to.equal('SV-219147r802349_rule') + }) + it('Should not append _rule because file already contains stigDatum.ATTRIBUTE_DATA + _rule', async () => { + const importOptions = { + autoStatus: 'submitted', + unreviewed: 'commented', + unreviewedCommented: 'informational', + emptyDetail: 'import', + emptyComment: 'import', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', // not used + required: 'always' + }, + comment: { + enabled: 'findings', // not used + required: 'optional' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/ckl/has-suffix_rule.ckl' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + + expect(review.checklists[0].reviews[0].ruleId).to.equal('SV-219147r802349_rule') + }) + it('Should return no review due to not containing a VULN_ATTRIBUTE = Rule_ID', async () => { + const importOptions = { + autoStatus: 'submitted', + unreviewed: 'commented', + unreviewedCommented: 'informational', + emptyDetail: 'import', + emptyComment: 'import', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', // not used + required: 'always' + }, + comment: { + enabled: 'findings', // not used + required: 'optional' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/ckl/vuln_attribute-no-Rule_ID.ckl' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + expect(review.checklists[0].reviews[0]).to.not.exist + }) + it('Should return no review due to not containing a ATTRIBUTE_DATA for a RULE_ID', async () => { + const importOptions = { + autoStatus: 'submitted', + unreviewed: 'commented', + unreviewedCommented: 'informational', + emptyDetail: 'import', + emptyComment: 'import', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', // not used + required: 'always' + }, + comment: { + enabled: 'findings', // not used + required: 'optional' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/ckl/vuln_attribute-no-Attribute_data.ckl' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + expect(review.checklists[0].reviews[0]).to.not.exist + }) +}) diff --git a/test/cklb-tests/CKLBStigViewerRuleId.test.js b/test/cklb-tests/CKLBStigViewerRuleId.test.js new file mode 100644 index 0000000..77e1a2c --- /dev/null +++ b/test/cklb-tests/CKLBStigViewerRuleId.test.js @@ -0,0 +1,190 @@ +import chai from 'chai' +import { reviewsFromCklb } from '../../ReviewParser.js' +import fs from 'fs/promises' +const expect = chai.expect + +// Create a helper function to read the file and generate the review object +async function generateReviewObject ( + filePath, + importOptions, + fieldSettings, + allowAccept +) { + const data = await fs.readFile(filePath, 'utf8') + return reviewsFromCklb({ + data, + fieldSettings, + allowAccept, + importOptions + }) +} + +describe('CKLB StigViewer 3.2 ruleID ', () => { + it('Should Append _rule to the files ruleId', async () => { + + const importOptions = { + autoStatus: 'saved', + unreviewed: 'always', + unreviewedCommented: 'informational', + emptyDetail: 'replace', + emptyComment: 'ignore', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', + required: 'always' + }, + comment: { + enabled: 'findings', + required: 'findings' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/cklb/no-suffix_rule.cklb' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + expect(review.checklists[0].reviews[0].ruleId).to.equal('SV-219147r802349_rule') + }) + it('Should not Append _rule to the files ruleId because it already has it.', async () => { + + const importOptions = { + autoStatus: 'saved', + unreviewed: 'always', + unreviewedCommented: 'informational', + emptyDetail: 'replace', + emptyComment: 'ignore', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', + required: 'always' + }, + comment: { + enabled: 'findings', + required: 'findings' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/cklb/has_suffix_rule.cklb' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + expect(review.checklists[0].reviews[0].ruleId).to.equal('SV-219147r802349_rule') + }) + it('Should return no review due to not containing a Rule_ID', async () => { + const importOptions = { + autoStatus: 'submitted', + unreviewed: 'commented', + unreviewedCommented: 'informational', + emptyDetail: 'import', + emptyComment: 'import', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', // not used + required: 'always' + }, + comment: { + enabled: 'findings', // not used + required: 'optional' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/cklb/no-Rule_ID.cklb' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + expect(review.checklists[0].reviews[0]).to.not.exist + }) + it('Should use the rule_id property. rule_id_src does not exit', async () => { + const importOptions = { + autoStatus: 'submitted', + unreviewed: 'always', + unreviewedCommented: 'informational', + emptyDetail: 'import', + emptyComment: 'import', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', // not used + required: 'always' + }, + comment: { + enabled: 'findings', // not used + required: 'optional' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/cklb/no-rule_id_src.cklb' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + expect(review.checklists[0].reviews[0].ruleId).to.equal('SV-219147r802349_rule') + }) + it('Should use the rule_id_src property. rule_id does not exit', async () => { + const importOptions = { + autoStatus: 'submitted', + unreviewed: 'always', + unreviewedCommented: 'informational', + emptyDetail: 'import', + emptyComment: 'import', + allowCustom: true + } + + const fieldSettings = { + detail: { + enabled: 'always', // not used + required: 'always' + }, + comment: { + enabled: 'findings', // not used + required: 'optional' + } + } + + const allowAccept = true + + const filePath = './WATCHER-test-files/WATCHER/cklb/no-rule_id_src.cklb' + + const review = await generateReviewObject( + filePath, + importOptions, + fieldSettings, + allowAccept + ) + expect(review.checklists[0].reviews[0].ruleId).to.equal('SV-219147r802349_rule') + }) +})