puppet-sec-lint 0.5.14 → 0.5.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4f5d30d4bf9e32338bf3c81fa619d6cb6560870343d01a62905282ac5724d6e
4
- data.tar.gz: d6d63ef87f2df9654f2edac1a1b75f3525b2bc514e46608f2990923b830a5134
3
+ metadata.gz: 269b5c5edfe9c78bf77bdee1dfd1d1a2cb3b20716c6aeec158d7b66c08d6e4a3
4
+ data.tar.gz: ab9c34d67d6320b4c235a394e7a5863d67a8eddc026978b30d14edd48de909cc
5
5
  SHA512:
6
- metadata.gz: 90e1f2fddbc2d97ad919d54e98870650f4d56b944676ff8f115a29b84395ae9413770d4985f45510fd77a5de46b5a4377b404974eb8265aca8a18087a9392d83
7
- data.tar.gz: 88312bf0a323156a1eb265700079cacf07c19e92c190d6b497acf28e2b08a92b7cb56ec7e656649ffff5865dfb7b08f546b0dc90f72fcba13fbf8e6fe2e8cd43
6
+ metadata.gz: 314f68b9f6bccd464511513006941fbcb2395a9cc5038ea30fad11f5c20debff9a92bb4343139159d15b0ffd66180514ff04383d7077c9628521b4bdf520b8ce
7
+ data.tar.gz: 44e430d28e8777da01a8277b3e5b3d1a59717e6a174c8e61ea26526d2c96cd916c0c0f7762f70bc29aee4147a405d2af75f7435b5a5e56f3488dbb85c2f38b4a
@@ -24,4 +24,8 @@ Any account with the power to do everything in the system is a very dangerous si
24
24
 
25
25
  ## How to avoid it?
26
26
 
27
- Accounts should always be setup up with the [Principle of least privilege](https://us-cert.cisa.gov/bsi/articles/knowledge/principles/least-privilege) in mind, meaning that all accounts should only get the permissions strictly necessary to perform their required tasks during the minimum amount of time possible. This severely limits the exposure to accidental errors and also to malicious attackers.
27
+ Accounts should always be setup up with the [Principle of least privilege](https://us-cert.cisa.gov/bsi/articles/knowledge/principles/least-privilege) in mind, meaning that all accounts should only get the permissions strictly necessary to perform their required tasks during the minimum amount of time possible. This severely limits the exposure to accidental errors and also to malicious attackers.
28
+
29
+ ## More related information
30
+
31
+ * [CWE-250: Execution with Unnecessary Privileges](https://cwe.mitre.org/data/definitions/250.html)
@@ -37,4 +37,8 @@ This malicious domain on a Puppet manifest can point to a fake package repositor
37
37
  After the tool detects the presence of Cyrillic characters on a URL, the best course of action is to replace all Cyrillic characters with their Latin counterparts, as these characters are very rarely used in legitimate domains.
38
38
  Then, check if the domain is well written (subtle misspellings with similar letters are very common in these kinds of attacks).
39
39
 
40
- To better ensure that the domain is actually the correct one, the URL can also be copied from a trusted source.
40
+ To better ensure that the domain is actually the correct one, the URL can also be copied from a trusted source.
41
+
42
+ ## More related information
43
+
44
+ * [CWE-1007: Insufficient Visual Distinction of Homoglyphs Presented to User](https://cwe.mitre.org/data/definitions/1007.html)
@@ -24,4 +24,8 @@ An attacker looking to gain access to an account my try a couple of different ge
24
24
 
25
25
  ## How to avoid it?
26
26
 
27
- Secure software systems should have a decent password policy that prevents, among other types, empty passwords. This means that it's very likely for the Puppet manifest to fail as the password would be rejected. But even if the target software accepts empty passwords, a long and hard to guess password is always a much safer option against malicious attacks.
27
+ Secure software systems should have a decent password policy that prevents, among other types, empty passwords. This means that it's very likely for the Puppet manifest to fail as the password would be rejected. But even if the target software accepts empty passwords, a long and hard to guess password is always a much safer option against malicious attacks.
28
+
29
+ ## More related information
30
+
31
+ * [CWE-258: Empty Password in Configuration File](https://cwe.mitre.org/data/definitions/258.html)
@@ -77,4 +77,9 @@ file { '/etc/mysql/server-key.pem':
77
77
  ensure => file,
78
78
  content => hiera("privatekey"),
79
79
  }
80
- ```
80
+ ```
81
+
82
+ ## More related information
83
+
84
+ * [CWE-259: Use of Hard-coded Password](https://cwe.mitre.org/data/definitions/259.html)
85
+ * [CWE-798: Use of Hard-coded Credentials](https://cwe.mitre.org/data/definitions/798.html)
@@ -39,4 +39,8 @@ The attacker can then use this information to attack his victim, by logging in a
39
39
 
40
40
  ## How to avoid it?
41
41
 
42
- All connections to internet addresses or made available to the public by a service configured with a Puppet manifest must use some kind of secure protocol, to ensure the confidentiality, authenticity and integrity of all data exchanged. Making an HTTPS connection is the easiest way to do this and it's also the recommended way of addressing this security vulnerability. In some cases, if the transferred information is verified afterwards by an hashing algorithm, like packages transferred from a repository, then this solution can be considered optional.
42
+ All connections to internet addresses or made available to the public by a service configured with a Puppet manifest must use some kind of secure protocol, to ensure the confidentiality, authenticity and integrity of all data exchanged. Making an HTTPS connection is the easiest way to do this and it's also the recommended way of addressing this security vulnerability. In some cases, if the transferred information is verified afterwards by an hashing algorithm, like packages transferred from a repository, then this solution can be considered optional.
43
+
44
+ ## More related information
45
+
46
+ * [CWE-319: Cleartext Transmission of Sensitive Information](https://cwe.mitre.org/data/definitions/319.html)
@@ -28,4 +28,8 @@ A server or service that's open to all kinds of connections it's more exposed to
28
28
 
29
29
  ## How to avoid it?
30
30
 
31
- Properly configuring binding addresses means that the server should only accept connections from trusted networks known to use the service. This ensures a greater level of control and also protection, as an attacker would know have an extra obstacle in trying to gain access first to one of those networks.
31
+ Properly configuring binding addresses means that the server should only accept connections from trusted networks known to use the service. This ensures a greater level of control and also protection, as an attacker would know have an extra obstacle in trying to gain access first to one of those networks.
32
+
33
+ ## More related information
34
+
35
+ * [CWE-284: Improper Access Control](https://cwe.mitre.org/data/definitions/284.html)
@@ -0,0 +1,31 @@
1
+ ---
2
+ title: Suspicious Comments
3
+ permalink: /suspicious-comments/
4
+ layout: default
5
+ ---
6
+
7
+ # Suspicious Comments
8
+
9
+ ## What are they?
10
+
11
+ Suspicious comments are all comments left in a release of a Puppet Manifest that might suggest the existence of bugs, missing security functionalities or other weaknesses.
12
+
13
+
14
+ ### Example
15
+ ```puppet
16
+ # TODO: switch password from weak hash to sha256
17
+ $key = md5("${client_name} ${client_ip} ${client_seed}")
18
+ ```
19
+ This comment immediately tells that developers are aware of the weakness of using a compromised hashing algorithm, but still hadn't made the necessary fix.
20
+
21
+ ## How can it be exploited?
22
+
23
+ In the previous example, the presence of the comment immediately draws the attention of a malicious hacker who might have gained access to the code repository. By stating the portion of code that is considered insecure, it tells to an attacker exactly where to look for unpatched vulnerabilities. In this case, he could start working on ways to break the weak hashing algorithm.
24
+
25
+ ## How to avoid it?
26
+
27
+ All comments indicating to be implemented features or non-resolved security issues should be erased, as they pose a very serious threat by gaining the attackers attention. Instead, proper and secure defect management solutions should be used. As a plus, the code stays clean and easy to read.
28
+
29
+ ## More related information
30
+
31
+ * [CWE-546: Suspicious Comment](https://cwe.mitre.org/data/definitions/546.html)
@@ -28,4 +28,9 @@ An attacker who was able to gain access to a server and steal the hashes from al
28
28
 
29
29
  ## How to avoid it?
30
30
 
31
- If the Puppet manifest is being used to generate hashes for passwords or important data, using a more secure algorithm like SHA256 is very advisable as it avoids exposure to the risks mentioned above, ensuring that the algorithm actually performs what's intended to.
31
+ If the Puppet manifest is being used to generate hashes for passwords or important data, using a more secure algorithm like SHA256 is very advisable as it avoids exposure to the risks mentioned above, ensuring that the algorithm actually performs what's intended to.
32
+
33
+ ## More related information
34
+
35
+ * [CWE-326: Inadequate Encryption Strength](https://cwe.mitre.org/data/definitions/326.html)
36
+ * [CWE-327: Use of a Broken or Risky Cryptographic Algorithm](https://cwe.mitre.org/data/definitions/327.html)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetSecLint
4
- VERSION = "0.5.14"
4
+ VERSION = "0.5.15"
5
5
  YEAR = "2021"
6
6
  AUTHOR = "TQRG"
7
7
  end
@@ -22,7 +22,7 @@ class NoHTTPRule < Rule
22
22
 
23
23
  ptokens = self.filter_resources(tokens, @resources_conf.value)
24
24
  ctokens = self.filter_variables(ptokens, @keywords_conf.value) #TODO: It's working upside down
25
- if @whitelist_conf.value
25
+ if not @whitelist_conf.value.empty?
26
26
  wtokens = self.filter_whitelist(ctokens, @whitelist_conf.value)
27
27
  else
28
28
  wtokens = ptokens
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-sec-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.14
4
+ version: 0.5.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Ribeiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-17 00:00:00.000000000 Z
11
+ date: 2021-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -178,6 +178,7 @@ files:
178
178
  - docs/images/puppet-sec-lint_vscode.png
179
179
  - docs/index.md
180
180
  - docs/invalid-ip-addr-binding.md
181
+ - docs/suspicious-comments.md
181
182
  - docs/weak-crypto-algorithm.md
182
183
  - exe/puppet-sec-lint
183
184
  - lib/configurations/boolean_configuration.rb
@@ -202,7 +203,6 @@ files:
202
203
  - lib/rules/use_weak_crypto_algorithms_rule.rb
203
204
  - lib/servers/language_server.rb
204
205
  - lib/servers/linter_server.rb
205
- - lib/settings.ini
206
206
  - lib/sin/sin.rb
207
207
  - lib/sin/sin_type.rb
208
208
  - lib/visitors/configuration_visitor.rb
data/lib/settings.ini DELETED
@@ -1,40 +0,0 @@
1
- [HardCodedCredentialsRule]
2
- HardCodedCredentialsRule-enable_configuration = true
3
- HardCodedCredentialsRule-list_of_known_words_not_considered_in_credentials = pe-puppet,pe-webserver,pe-puppetdb,pe-postgres,pe-console-services,pe-orchestration-services,pe-ace-server,pe-bolt-server
4
- HardCodedCredentialsRule-list_of_invalid_values_in_credentials = undefined,unset,www-data,wwwrun,www,no,yes,[],root
5
- HardCodedCredentialsRule-regular_expression_of_words_present_in_credentials = (?-mix:user|usr|pass(word|_|$)|pwd|key|secret)
6
- HardCodedCredentialsRule-regular_expression_of_words_not_present_in_credentials = (?-mix:gpg|path|type|buff|zone|mode|tag|header|scheme|length|guid)
7
-
8
- [NoHTTPRule]
9
- NoHTTPRule-enable_configuration = true
10
- NoHTTPRule-list_of_resources_that_can_use_http = apt::source,::apt::source,wget::fetch,yumrepo,yum::,aptly::mirror,util::system_package,yum::managed_yumrepo
11
- NoHTTPRule-list_of_keywords_for_urls = backport,key,download,uri,mirror
12
- NoHTTPRule-regular_expression_of_a_normal_http_address = (?-mix:^http:\/\/.+)
13
- NoHTTPRule-http_address_whitelist = (?-mix:^(127.0.0.1))
14
-
15
- [AdminByDefaultRule]
16
- AdminByDefaultRule-enable_configuration = true
17
- AdminByDefaultRule-regular_expression_of_words_present_in_credentials = (?-mix:user|usr|pass(word|_|$)|pwd)
18
-
19
- [EmptyPasswordRule]
20
- EmptyPasswordRule-enable_configuration = true
21
- EmptyPasswordRule-list_of_trigger_words = pwd,password,pass
22
- EmptyPasswordRule-regular_expression_of_password_name = (?-mix:pass(word|_|$)|pwd)
23
-
24
- [InvalidIPAddrBindingRule]
25
- InvalidIPAddrBindingRule-enable_configuration = true
26
- InvalidIPAddrBindingRule-regular_expression_of_an_invalid_ip_address = (?-mix:^((http(s)?:\/\/)?0.0.0.0(:\d{1,5})?)$)
27
-
28
- [UseWeakCryptoAlgorithmsRule]
29
- UseWeakCryptoAlgorithmsRule-enable_configuration = true
30
- UseWeakCryptoAlgorithmsRule-regular_expression_of_weak_crypto_algorithms = (?-mix:^(sha1|md5))
31
-
32
- [SuspiciousCommentRule]
33
- SuspiciousCommentRule-enable_configuration = true
34
- SuspiciousCommentRule-list_of_trigger_words = hack,fixme,later,later2,todo,ticket,launchpad,bug,to-do
35
- SuspiciousCommentRule-regular_expression_of_keywords_present_in_suspicious_comments = (?-mix:hack|fixme|ticket|bug|secur|debug|defect|weak)
36
-
37
- [CyrillicHomographAttack]
38
- CyrillicHomographAttack-enable_configuration = true
39
- CyrillicHomographAttack-regular_expression_of_links_with_cyrillic_characters = (?-mix:^(http(s)?:\/\/)?.*\p{Cyrillic}+)
40
-