puppet-sec-lint 0.5.6 → 0.5.7

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: 9122cfc7a33eaeec5420572853a125a9689e5cbb991b4f01d91fa329797c894c
4
- data.tar.gz: a69e4c6c6cf57eef56f0827a04464b005e3796f5831117127360ec29aaad7a90
3
+ metadata.gz: 7b342570d0cd33a8818a927585edab299dc3117eea0bd92ca2b017045627836f
4
+ data.tar.gz: 14c9957c5262ca2b9dfa209740fc3de748fb326009ca24a98b3fc046b99defa2
5
5
  SHA512:
6
- metadata.gz: 8795ab736c4f332c9de27803b3fb87dfeb4e6828b559eb01b92fb1df968ce3a8d471f102161e65f02a43fa1e5d91b9d55d4c53a7a41c07b0d564d401f9643f91
7
- data.tar.gz: 68fc3d3ae216a5752d89245847dea69d10579d8eb411835a9b9c97c66f40ef59e5481db97e1787e4ca527b29ee2bc4a687e747127a62e288e09f69823b69e325
6
+ metadata.gz: 326b1e1ef9084032fa9fe0e2403c666d7ea385806a42848a9939ff0e3b62837d28f2af794ee9f4cf45cabaffac891b5787164a8b89d0182f1d0cb21d3ba17fee
7
+ data.tar.gz: 440a31bcac39c6818463e8fec34611e7df7f7779ac05b69b697c1caa24ce9006dbdd5e8316081708eeae19f85af18c381fb1a07cf25f4efb5fd3fe3d18074e63
@@ -28,16 +28,16 @@
28
28
  <option name="myRootTask">
29
29
  <RakeTaskImpl id="rake">
30
30
  <subtasks>
31
- <RakeTaskImpl description="Build puppet-sec-lint-0.1.2.gem into the pkg directory" fullCommand="build" id="build" />
31
+ <RakeTaskImpl description="Build puppet-sec-lint-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
32
32
  <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
33
33
  <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
34
- <RakeTaskImpl description="Build and install puppet-sec-lint-0.1.2.gem into system gems" fullCommand="install" id="install" />
34
+ <RakeTaskImpl description="Build and install puppet-sec-lint-0.1.0.gem into system gems" fullCommand="install" id="install" />
35
35
  <RakeTaskImpl id="install">
36
36
  <subtasks>
37
- <RakeTaskImpl description="Build and install puppet-sec-lint-0.1.2.gem into system gems without network access" fullCommand="install:local" id="local" />
37
+ <RakeTaskImpl description="Build and install puppet-sec-lint-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
38
38
  </subtasks>
39
39
  </RakeTaskImpl>
40
- <RakeTaskImpl description="Create tag v0.1.2 and build and push puppet-sec-lint-0.1.2.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
40
+ <RakeTaskImpl description="Create tag v0.1.0 and build and push puppet-sec-lint-0.1.0.gem to TODO: Set to 'http://mygemserver.com'" fullCommand="release[remote]" id="release[remote]" />
41
41
  <RakeTaskImpl description="Run tests" fullCommand="test" id="test" />
42
42
  <RakeTaskImpl description="" fullCommand="default" id="default" />
43
43
  <RakeTaskImpl description="" fullCommand="release" id="release" />
data/Gemfile.lock CHANGED
@@ -1,14 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet-sec-lint (0.5.2)
4
+ puppet-sec-lint (0.5.6)
5
5
  inifile (~> 3.0.0)
6
6
  launchy (~> 2.5.0)
7
7
  minitest (~> 5.0)
8
8
  puppet-lint (~> 2.4, >= 2.4.2)
9
9
  rack (~> 2.2.3)
10
10
  rake (~> 13.0)
11
- thin (~> 1.8.0)
12
11
 
13
12
  GEM
14
13
  remote: https://rubygems.org/
data/docs/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (6.0.3.6)
4
+ activesupport (6.0.3.7)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
6
  i18n (>= 0.7, < 2)
7
7
  minitest (~> 5.1)
@@ -25,7 +25,7 @@ GEM
25
25
  ethon (0.14.0)
26
26
  ffi (>= 1.15.0)
27
27
  eventmachine (1.2.7)
28
- execjs (2.7.0)
28
+ execjs (2.8.0)
29
29
  faraday (1.4.1)
30
30
  faraday-excon (~> 1.1)
31
31
  faraday-net_http (~> 1.0)
@@ -228,7 +228,7 @@ GEM
228
228
  forwardable-extended (~> 2.6)
229
229
  public_suffix (4.0.6)
230
230
  racc (1.5.2)
231
- rb-fsevent (0.10.4)
231
+ rb-fsevent (0.11.0)
232
232
  rb-inotify (0.10.1)
233
233
  ffi (~> 1.0)
234
234
  rexml (3.2.5)
data/docs/_config.yml CHANGED
@@ -13,14 +13,10 @@
13
13
  # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
14
14
  # You can create any custom variable you would like, and they will be accessible
15
15
  # in the templates via {{ site.myvariable }}.
16
- title: Puppet Securtiy Linter
16
+ title: Puppet Security Linter
17
17
  email: tiago7b27@gmail.com
18
18
  description: >- # this means to ignore newlines until "baseurl:"
19
- Scurity focused linter to detect and help solve vulnearbilities found on Puppet Infrastructure-as-code scripts
20
- baseurl: "" # the subpath of your site, e.g. /blog
21
- url: "" # the base hostname & protocol for your site, e.g. http://example.com
22
- twitter_username: jekyllrb
23
- github_username: jekyll
19
+ Security focused linter to detect and help solve vulnerabilities found on Puppet Infrastructure-as-code scripts
24
20
 
25
21
  # Build settings
26
22
  markdown: kramdown
data/docs/_site/404.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset='utf-8'>
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link rel="stylesheet" href="/assets/css/style.css?v=451ab93a01ea7ba9ec933d2a6c0ad3f1555b70e0">
7
+ <link rel="stylesheet" href="/assets/css/style.css?v=b8f4fcea6993188f9bfaf6d72181f63f9e7a5872">
8
8
 
9
9
  <!-- Begin Jekyll SEO tag v2.7.1 -->
10
10
  <title>Puppet Securtiy Linter | Scurity focused linter to detect and help solve vulnearbilities found on Puppet Infrastructure-as-code scripts</title>
@@ -19,7 +19,7 @@
19
19
  <meta name="twitter:card" content="summary" />
20
20
  <meta property="twitter:title" content="Puppet Securtiy Linter" />
21
21
  <script type="application/ld+json">
22
- {"@type":"WebPage","headline":"Puppet Securtiy Linter","description":"Scurity focused linter to detect and help solve vulnearbilities found on Puppet Infrastructure-as-code scripts","url":"http://localhost:4000/404.html","@context":"https://schema.org"}</script>
22
+ {"headline":"Puppet Securtiy Linter","description":"Scurity focused linter to detect and help solve vulnearbilities found on Puppet Infrastructure-as-code scripts","url":"http://localhost:4000/404.html","@type":"WebPage","@context":"https://schema.org"}</script>
23
23
  <!-- End Jekyll SEO tag -->
24
24
 
25
25
  </head>
data/docs/_site/feed.xml CHANGED
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2021-05-03T22:26:18+01:00</updated><id>http://localhost:4000/feed.xml</id><title type="html">Puppet Securtiy Linter</title><subtitle>Scurity focused linter to detect and help solve vulnearbilities found on Puppet Infrastructure-as-code scripts</subtitle><entry><title type="html">Welcome to Jekyll!</title><link href="http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Welcome to Jekyll!" /><published>2021-05-03T21:09:12+01:00</published><updated>2021-05-03T21:09:12+01:00</updated><id>http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll</id><content type="html" xml:base="http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll.html">&lt;p&gt;You’ll find this post in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll serve&lt;/code&gt;, which launches a web server and auto-regenerates your site when a file is updated.&lt;/p&gt;
1
+ <?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2021-05-13T01:19:00+01:00</updated><id>http://localhost:4000/feed.xml</id><title type="html">Puppet Securtiy Linter</title><subtitle>Scurity focused linter to detect and help solve vulnearbilities found on Puppet Infrastructure-as-code scripts</subtitle><entry><title type="html">Welcome to Jekyll!</title><link href="http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Welcome to Jekyll!" /><published>2021-05-03T21:09:12+01:00</published><updated>2021-05-03T21:09:12+01:00</updated><id>http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll</id><content type="html" xml:base="http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll.html">&lt;p&gt;You’ll find this post in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll serve&lt;/code&gt;, which launches a web server and auto-regenerates your site when a file is updated.&lt;/p&gt;
2
2
 
3
3
  &lt;p&gt;To add new posts, simply add a file in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory that follows the convention &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;YYYY-MM-DD-name-of-post.ext&lt;/code&gt; and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.&lt;/p&gt;
4
4
 
@@ -4,7 +4,7 @@
4
4
  <meta charset='utf-8'>
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link rel="stylesheet" href="/assets/css/style.css?v=451ab93a01ea7ba9ec933d2a6c0ad3f1555b70e0">
7
+ <link rel="stylesheet" href="/assets/css/style.css?v=b8f4fcea6993188f9bfaf6d72181f63f9e7a5872">
8
8
 
9
9
  <!-- Begin Jekyll SEO tag v2.7.1 -->
10
10
  <title>Welcome to Jekyll! | Puppet Securtiy Linter</title>
@@ -21,7 +21,7 @@
21
21
  <meta name="twitter:card" content="summary" />
22
22
  <meta property="twitter:title" content="Welcome to Jekyll!" />
23
23
  <script type="application/ld+json">
24
- {"@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll.html"},"headline":"Welcome to Jekyll!","dateModified":"2021-05-03T21:09:12+01:00","datePublished":"2021-05-03T21:09:12+01:00","description":"You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.","url":"http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll.html","@context":"https://schema.org"}</script>
24
+ {"headline":"Welcome to Jekyll!","dateModified":"2021-05-03T21:09:12+01:00","datePublished":"2021-05-03T21:09:12+01:00","description":"You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.","url":"http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll.html","@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/jekyll/update/2021/05/03/welcome-to-jekyll.html"},"@context":"https://schema.org"}</script>
25
25
  <!-- End Jekyll SEO tag -->
26
26
 
27
27
  </head>
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: Admin by default
3
+ permalink: /admin-by-default/
4
+ layout: default
5
+ ---
6
+
7
+ # Admin by default
8
+
9
+ ## What is it?
10
+
11
+ An user who is created with administrator privileges usually has permission to do everything in the system. It's usually identified with the username 'admin' in a lot of software applications.
12
+
13
+ ### Example
14
+ ```puppet
15
+ user { 'admin':
16
+ ensure => 'present'
17
+ }
18
+ ```
19
+ This user, with the username 'admin', will likely have a big concentration of privileges by default.
20
+
21
+ ## How can it be exploited?
22
+
23
+ Any account with the power to do everything in the system is a very dangerous single point of failure. Firstly, even during normal operations, it allows for its user to potentially change the system in unwanted ways, or even access information that he's not supposed to. Even worse, it presents a very dangerous point of entry for an attacker, as he just needs to compromise this single password to have complete access to the system.
24
+
25
+ ## How to avoid it?
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.
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: Cyrillic Homograph Attack
3
+ permalink: /cyrillic-homograph-attack/
4
+ layout: default
5
+ ---
6
+
7
+ # Cyrillic Homograph Attack
8
+
9
+ ## What are they?
10
+
11
+ A Cyrillic Homograph attack takes advantage of the fact that several characters in the [Cyrillic alphabet](https://www.britannica.com/topic/Cyrillic-alphabet) are virtually indistinguishable (homographs) from regular Latin ones in a lot of fonts. This makes it possible for attackers to setup fake domains with Cyrillic characters that look identical to the real one but redirect the user to a malicious website.
12
+
13
+ ### Example
14
+ These two website links look identical:
15
+ ```
16
+ https://google.com
17
+ https://gооgle.com
18
+ ```
19
+
20
+ But after taking a closer look at the code of each character of the website name only, it's possible to see where the attack can be made:
21
+ ```
22
+ \u0067 \u006f \u006f \u0067 \u006c \u0065 \u002e \u0063 \u006f \u006d
23
+ \u0067 \u043e \u043e \u0067 \u006c \u0065 \u002e \u0063 \u006f \u006d
24
+ g o o g l e . c o m
25
+ ```
26
+
27
+ It's possible to see that the second and third characters in the word "google" are different. On the top domain, the Latin o letter is used (unicode u006f) but on the bottom one, the Cyrillic о letter is used (unicode u043e). Although similar, the bottom website can point to a completely different server.
28
+
29
+ ## How can it be exploited?
30
+
31
+ To exploit this vulnerability, an attacker can setup, for example, a malicious software repository and register a domain that looks exactly like an existing legitimate one, but written with Cyrillic characters. It's even possible to request a SSL certificate for it, making it possible to receive HTTPS connections, further convincing the user of its authenticity.
32
+
33
+ This malicious domain on a Puppet manifest can point to a fake package repository, containing malware infected versions of legitimate packages. These malicious packages would then be installed in all infrastructure deployed by that manifest, causing a widespread infection that could severely compromise the integrity of the systems.
34
+
35
+ ## How to avoid it?
36
+
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
+ Then, check if the domain is well written (subtle misspellings with similar letters are very common in these kinds of attacks).
39
+
40
+ To better ensure that the domain is actually the correct one, the URL can also be copied from a trusted source.
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: Empty Password
3
+ permalink: /empty-password/
4
+ layout: default
5
+ ---
6
+
7
+ # Empty password
8
+
9
+ ## What are they?
10
+
11
+ An account with an empty password is different from an account with no password. Here, the password exists, it's prompted but it's an empty string.
12
+
13
+ ### Example
14
+ If an account has an empty password, when logging in, the user should still be prompted fo input the password:
15
+ ```
16
+ Password:
17
+ ```
18
+
19
+ But a simple click on the return key, without actually writing anything, is enough to log in.
20
+
21
+ ## How can it be exploited?
22
+
23
+ An attacker looking to gain access to an account my try a couple of different generic and vulnerable passwords to brute force his way in. One of his first attempts may be to just press return without actually writing anything. This makes for a very easy password to be guessed.
24
+
25
+ ## How to avoid it?
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.
@@ -1,17 +1,80 @@
1
1
  ---
2
2
  title: Hard Coded Credentials
3
3
  permalink: /hard-coded-credentials/
4
+ layout: default
4
5
  ---
5
6
 
6
7
  # Hard Coded Credentials
7
8
 
8
- Writing sensitive credentials on puppet scripts can expose them to malicious actors who can obtain access to these files.
9
+ ## What are they?
9
10
 
10
- ## Example
11
+ Hard Coded credentials are sensitive information, like passwords, private keys and other secrets, that are written directly on the source code, in plain text.
12
+ ### Examples
13
+ Username and password for a mysql database:
14
+ ```puppet
15
+ mysql::user { 'pdns':
16
+ password => 'pdns123pass',
17
+ requires => Mysql::Database['pdns'];
18
+ }
19
+ ```
11
20
 
21
+ Private key used to access a database:
12
22
  ```puppet
13
- class example::service (
14
- $username = "user1",
15
- $passsword = "amind1234"
16
- )
23
+ file { '/etc/mysql/server-key.pem':
24
+ ensure => file,
25
+ content => '-----BEGIN RSA PRIVATE KEY-----
26
+ MIIEpAIBAAKCAQEA9bftj7SJfMpBqk7eza3I1Tp4n3VbjkEo7pq9ft6hCpSHaThN
27
+ OU362GyeLawZNTCtROePj3g2StB3UFQTGRe5Xbl510UaoRwSpHnUSTaDfjPeT8SX
28
+ (...)
29
+ nh0c2NOM2YaGl1J0/WUnzsg7ZDMY6S9zQQ/KZP6LVm4P5yn3k8h8B9FL13a9AK83
30
+ 89RotRTzKPEAh7SjI84GAVUn6BcxsrVroe3p45E9KpX1bgYCkvu45Q==
31
+ -----END RSA PRIVATE KEY-----',
32
+ }
33
+ ```
34
+
35
+ ## How can it be exploited?
36
+
37
+ Having hard coded credentials in code can expose the software to several kinds of vulnerabilities:
38
+ * If the puppet manifest is used to deploy several different machines, because the credentials are hard coded, all of them will share the same credentials. This make it possible for an attacker to exploit all machines after compromising just one of them.
39
+ * It's hard to manage and rotate secrets if these ever get compromised, as they can be distributed across several different manifests.
40
+ * If an attacker ever gets hold of the source code (by compromising the code repository or the local machine of one developer for example), he can easily access the credentials for potentially all machines in the system.
41
+ This is an even bigger problem if the source code is open source, as in that case the passwords are completely open to anyone to see them.
42
+
43
+ ## How to avoid it?
44
+
45
+ There are much better ways to store credentials and other secrets. A fairly easy and secure way is by using a tool provided by Puppet called [Hiera](https://puppet.com/docs/puppet/7.6/hiera.html).
46
+
47
+ It allows the storage of credentials and other data in a centralized file, using then keys to reference them in the source code. This allows for an easy management of the passwords and the possibility of, for example, quickly rotating them between installations.
48
+
49
+ For even more security, [Hiera can use an encrypted file](https://puppet.com/blog/encrypt-your-data-using-hiera-eyaml/), protecting also against attackers who might, for example, gain access to the source code repository.
50
+
51
+ ### Example
52
+
53
+ A **secrets.yaml** file containing the password:
54
+
55
+ ```yaml
56
+ ---
57
+ password: pdns123pass
58
+ privatekey: |-
59
+ -----BEGIN OPENSSH PRIVATE KEY-----
60
+ b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
61
+ NhAAAAAwEAAQAAAQEAssBRe91wZ0TJBIWK2V1NH/ourcFPb0cA4ln32a3j5QITMS3zhs/o
62
+ (...)
63
+ C8YRNCLnBgR2CCp27D0wuadL9aFITlx91GPytF9BKxzy949VaF6SEw9M86oouj362u/BvP
64
+ CO7Hnjlg77HRNFXPAAAAFWxrYW1pcmVkZHlAdm13YXJlLmNvbQECAwQF
65
+ -----END OPENSSH PRIVATE KEY-----
17
66
  ```
67
+
68
+ And then the source code from the examples above, but now without hard coded credentials:
69
+
70
+ ```puppet
71
+ mysql::user { 'pdns':
72
+ password => hiera("password"),
73
+ requires => Mysql::Database['pdns'];
74
+ }
75
+
76
+ file { '/etc/mysql/server-key.pem':
77
+ ensure => file,
78
+ content => hiera("privatekey"),
79
+ }
80
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ title: Invalid IP Address binding
3
+ permalink: /invalid-ip-addr-binding/
4
+ layout: default
5
+ ---
6
+
7
+ # Invalid IP Address binding
8
+
9
+ ## What it it?
10
+
11
+ Binding an IP address to a server or service means authorizing connections incoming from those networks. This allows to limit what kind of incoming connections a server may or may not accept. Binding the 0.0.0.0 IP address to a service means that any connection from any network is accepted.
12
+
13
+ ### Example
14
+ Using Puppet to configure a MySQL database bind address:
15
+ ```puppet
16
+ class { 'mysql::server':
17
+ config_hash => {
18
+ 'bind_address' => '0.0.0.0'
19
+ }
20
+ }
21
+ ```
22
+ This configuration means that the database accepts connections from anywhere, including remote clients if it's connected to the internet.
23
+
24
+
25
+ ## How can it be exploited?
26
+
27
+ A server or service that's open to all kinds of connections it's more exposed to possible attacks coming from non intended networks. A malicious attacker can try to gain access to it just by using it's own network or other compromised networks across the globe.
28
+
29
+ ## How to avoid it?
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.
@@ -0,0 +1,31 @@
1
+ ---
2
+ title:
3
+ permalink: /weak-crypto-algorithm/
4
+ layout: default
5
+ ---
6
+
7
+ # Use of weak Cryptographic algorithms
8
+
9
+ ## What are they?
10
+
11
+ A Cryptographic hash algorithm is a one-way function used to map data to an unique fixed-sized sequence of bytes. This has several applications in CyberSecurity, like storing passwords securely in a server for example. The strength of an algorithm is measured by its ability to generate a truly unique output for every unique input and also by its ability to be non reversible, meaning that it should be impossible to determine the original value given the generated hash.
12
+
13
+ Weak algorithms like MD5 or SHA-1, either by their age or by their design flaws, are known to not ensure these properties.
14
+
15
+ ### Example
16
+ The weakness of the SHA-1 algorithm was originally demonstrated with the collision shown on [this website](https://shattered.it):
17
+
18
+ ```shell
19
+ $ sha1sum *.pdf
20
+ 38762cf7f55934b34d179ae6a4c80cadccbb7f0a shattered-1.pdf
21
+ 38762cf7f55934b34d179ae6a4c80cadccbb7f0a shattered-2.pdf
22
+ ```
23
+ They have two different .pdf files that should generate two different hashes, but as shown above, the resulting hash is exactly the same.
24
+
25
+ ## How can it be exploited?
26
+
27
+ An attacker who was able to gain access to a server and steal the hashes from all passwords may exploit the weaknesses on the hashing algorithm to either try to reverse them or perform a collision attack. This happens because the algorithm allows the existence of collisions, meaning that an attacker may be able to brute force an hash without even finding the original password.
28
+
29
+ ## How to avoid it?
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.
data/lib/lol.pp CHANGED
@@ -8,17 +8,17 @@
8
8
  # the following code addresses the bug: https://bugs.launchpad.net/keystone/+bug/1472285 .
9
9
 
10
10
  class consul_template::service (
11
- $pass = lols(3),
12
- $aijoijooiumihhn_password = 'pe-puppet'
13
- $admin = 'ceisssesrelometer',
14
- $aijoijooiumihhn_password = '(adiyu(guygmin',
11
+ $rpc_password = '{6ad470ec62b0511b63340dca2950d750181598efnHKvN1ge',
12
+ $admin_username = 'admin',
13
+ $password = 'ceilometer',
14
+ $admin_password = 'admin',
15
15
  ) {
16
16
  exec { 'network-restart':
17
17
  command => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM release-runner key',
18
18
  path => '/usr/bin:/usr/sbin:/bin:/sbin',
19
19
  refreshonly => true,
20
20
  vmware_md5 => 'LOL',
21
- autho => 'MDi09i09i5',
21
+ autho => 'MD5',
22
22
  cmd => 'virsh secret-define --file ${secret_xml} && virsh secret-set-value --secret ${rbd_secret_uuid} --base64 $(ceph auth get-key client.${user})',
23
23
  $auth_uri => 'http://127.0.0.1:5000',
24
24
  'bind_address' => '0.0.0.0',
@@ -80,4 +80,4 @@ UcXHbA==
80
80
  replace => true,
81
81
  require => File['/var/lib/gerrit/.ssh']
82
82
  }
83
- }
83
+ }
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetSecLint
4
- VERSION = "0.5.6"
4
+ VERSION = "0.5.7"
5
5
  YEAR = "2021"
6
6
  AUTHOR = "Tiago Ribeiro"
7
7
  end
@@ -34,7 +34,6 @@ Gem::Specification.new do |spec|
34
34
  spec.add_runtime_dependency 'rake', '~> 13.0'
35
35
  spec.add_runtime_dependency 'minitest', '~> 5.0'
36
36
  spec.add_runtime_dependency 'rack', '~> 2.2.3'
37
- spec.add_runtime_dependency 'thin', '~> 1.8.0'
38
37
  spec.add_runtime_dependency 'inifile', '~> 3.0.0'
39
38
  spec.add_runtime_dependency 'launchy', '~> 2.5.0'
40
39
 
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.6
4
+ version: 0.5.7
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-12 00:00:00.000000000 Z
11
+ date: 2021-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -72,20 +72,6 @@ dependencies:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: 2.2.3
75
- - !ruby/object:Gem::Dependency
76
- name: thin
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: 1.8.0
82
- type: :runtime
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: 1.8.0
89
75
  - !ruby/object:Gem::Dependency
90
76
  name: inifile
91
77
  requirement: !ruby/object:Gem::Requirement
@@ -149,14 +135,20 @@ files:
149
135
  - docs/_posts/2021-05-03-welcome-to-jekyll.markdown
150
136
  - docs/_site/404.html
151
137
  - docs/_site/feed.xml
138
+ - docs/_site/images/puppet-sec-lint_console.png
139
+ - docs/_site/images/puppet-sec-lint_vscode.png
152
140
  - docs/_site/index.html
153
141
  - docs/_site/jekyll/update/2021/05/03/welcome-to-jekyll.html
142
+ - docs/admin-by-default.md
143
+ - docs/cyrillic-homograph-attack.md
144
+ - docs/empty-password.md
154
145
  - docs/hard-coded-credentials.md
155
146
  - docs/images/puppet-sec-lint_console.png
156
147
  - docs/images/puppet-sec-lint_vscode.png
157
148
  - docs/index.md
149
+ - docs/invalid-ip-addr-binding.md
150
+ - docs/weak-crypto-algorithm.md
158
151
  - exe/puppet-sec-lint
159
- - file.pp
160
152
  - lib/configurations/boolean_configuration.rb
161
153
  - lib/configurations/configuration.rb
162
154
  - lib/configurations/list_configuration.rb
@@ -177,17 +169,9 @@ files:
177
169
  - lib/rules/use_weak_crypto_algorithms_rule.rb
178
170
  - lib/servers/language_server.rb
179
171
  - lib/servers/linter_server.rb
180
- - lib/settings.ini
181
172
  - lib/sin/sin.rb
182
173
  - lib/sin/sin_type.rb
183
- - lib/test.txt
184
- - lib/test2.rb
185
- - lib/test3.rb
186
- - lib/test_new.rb
187
174
  - lib/visitors/configuration_visitor.rb
188
- - puppet-sec-lint-0.5.3.gem
189
- - puppet-sec-lint-0.5.4.gem
190
- - puppet-sec-lint-0.5.5.gem
191
175
  - puppet-sec-lint.gemspec
192
176
  homepage: https://github.com/TiagoR98/puppet-sec-lint
193
177
  licenses:
data/file.pp DELETED
@@ -1,77 +0,0 @@
1
- # the following code addresses the bug: https://bugs.launchpad.net/keystone/+bug/1472285 .
2
-
3
- class consul_template::service (
4
- $pass = lols(3),
5
- $aijoijooiumihhn_password = 'pe-puppet'
6
- $admin = 'ceisssesrelometer',
7
- $aijoijooiumihhn_password = '(adiyu(guygmin',
8
- ) {
9
- exec { 'network-restart':
10
- command => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM release-runner key',
11
- path => '/usr/bin:/usr/sbin:/bin:/sbin',
12
- refreshonly => true,
13
- vmware_md5 => 'LOL',
14
- autho => 'MDi09i09i5',
15
- cmd => 'virsh secret-define --file ${secret_xml} && virsh secret-set-value --secret ${rbd_secret_uuid} --base64 $(ceph auth get-key client.${user})',
16
- $auth_uri => 'http://127.0.0.1:5000',
17
- address => '0.0.0.0',
18
- user = 'admin',
19
- password => '',
20
- }
21
- case $::osfamily {
22
- 'RedHat': {
23
- exec { 'upload-img':
24
- command => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} add name=${img_name} is_public=${public} container_format=${container_format} disk_format=${disk_format} distro=${os_name} < /opt/vm/cirros-x86_64-disk.img",
25
- unless => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index && (/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index | grep ${img_name})",
26
-
27
- }
28
- }
29
- 'Debian': {
30
- exec { 'upload-img':
31
- command => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} add name=${img_name} is_public=${public} container_format=${container_format} disk_format=${disk_format} distro=${os_name} < /usr/share/cirros-testvm/cirros-x86_64-disk.img",
32
- unless => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index && (/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index | grep ${img_name})",
33
- key => "E8CC67053ED3B199",
34
- key_content => '-----BEGIN PGP PUBLIC KEY BLOCK-----
35
- Version: GnuPG v1.4.11 (GNU/Linux)
36
-
37
- mQENBE/oXVkBCACcjAcV7lRGskECEHovgZ6a2robpBroQBW+tJds7B+qn/DslOAN
38
- 1hm0UuGQsi8pNzHDE29FMO3yOhmkenDd1V/T6tHNXqhHvf55nL6anlzwMmq3syIS
39
- uqVjeMMXbZ4d+Rh0K/rI4TyRbUiI2DDLP+6wYeh1pTPwrleHm5FXBMDbU/OZ5vKZ
40
- 67j99GaARYxHp8W/be8KRSoV9wU1WXr4+GA6K7ENe2A8PT+jH79Sr4kF4uKC3VxD
41
- BF5Z0yaLqr+1V2pHU3AfmybOCmoPYviOqpwj3FQ2PhtObLs+hq7zCviDTX2IxHBb
42
- Q3mGsD8wS9uyZcHN77maAzZlL5G794DEr1NLABEBAAG0NU9wZW5TdGFja0BDaXNj
43
- byBBUFQgcmVwbyA8b3BlbnN0YWNrLWJ1aWxkZEBjaXNjby5jb20+iQE4BBMBAgAi
44
- BQJP6F1ZAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRDozGcFPtOxmXcK
45
- B/9WvQrBwxmIMV2M+VMBhQqtipvJeDX2Uv34Ytpsg2jldl0TS8XheGlUNZ5djxDy
46
- u3X0hKwRLeOppV09GVO3wGizNCV1EJjqQbCMkq6VSJjD1B/6Tg+3M/XmNaKHK3Op
47
- zSi+35OQ6xXc38DUOrigaCZUU40nGQeYUMRYzI+d3pPlNd0+nLndrE4rNNFB91dM
48
- BTeoyQMWd6tpTwz5MAi+I11tCIQAPCSG1qR52R3bog/0PlJzilxjkdShl1Cj0RmX
49
- 7bHIMD66uC1FKCpbRaiPR8XmTPLv29ZTk1ABBzoynZyFDfliRwQi6TS20TuEj+ZH
50
- xq/T6MM6+rpdBVz62ek6/KBcuQENBE/oXVkBCACgzyyGvvHLx7g/Rpys1WdevYMH
51
- THBS24RMaDHqg7H7xe0fFzmiblWjV8V4Yy+heLLV5nTYBQLS43MFvFbnFvB3ygDI
52
- IdVjLVDXcPfcp+Np2PE8cJuDEE4seGU26UoJ2pPK/IHbnmGWYwXJBbik9YepD61c
53
- NJ5XMzMYI5z9/YNupeJoy8/8uxdxI/B66PL9QN8wKBk5js2OX8TtEjmEZSrZrIuM
54
- rVVXRU/1m732lhIyVVws4StRkpG+D15Dp98yDGjbCRREzZPeKHpvO/Uhn23hVyHe
55
- PIc+bu1mXMQ+N/3UjXtfUg27hmmgBDAjxUeSb1moFpeqLys2AAY+yXiHDv57ABEB
56
- AAGJAR8EGAECAAkFAk/oXVkCGwwACgkQ6MxnBT7TsZng+AgAnFogD90f3ByTVlNp
57
- Sb+HHd/cPqZ83RB9XUxRRnkIQmOozUjw8nq8I8eTT4t0Sa8G9q1fl14tXIJ9szzz
58
- BUIYyda/RYZszL9rHhucSfFIkpnp7ddfE9NDlnZUvavnnyRsWpIZa6hJq8hQEp92
59
- IQBF6R7wOws0A0oUmME25Rzam9qVbywOh9ZQvzYPpFaEmmjpCRDxJLB1DYu8lnC4
60
- h1jP1GXFUIQDbcznrR2MQDy5fNt678HcIqMwVp2CJz/2jrZlbSKfMckdpbiWNns/
61
- xKyLYs5m34d4a0it6wsMem3YCefSYBjyLGSd/kCI/CgOdGN1ZY1HSdLmmjiDkQPQ
62
- UcXHbA==
63
- =v6jg
64
- -----END PGP PUBLIC KEY BLOCK-----',
65
-
66
- }
67
- }
68
- }
69
- file { '/var/lib/gerrit/.ssh/id_rsa' :
70
- owner => 'gerrit',
71
- group => 'gerrit',
72
- mode => '0600',
73
- content => $ssh_replication_rsa_key_contents,
74
- replace => true,
75
- require => File['/var/lib/gerrit/.ssh']
76
- }
77
- }
data/lib/settings.ini DELETED
@@ -1,39 +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
-
14
- [AdminByDefaultRule]
15
- AdminByDefaultRule-enable_configuration = true
16
- AdminByDefaultRule-regular_expression_of_words_present_in_credentials = (?-mix:user|usr|pass(word|_|$)|pwd)
17
-
18
- [EmptyPasswordRule]
19
- EmptyPasswordRule-enable_configuration = true
20
- EmptyPasswordRule-list_of_trigger_words = pwd,password,pass
21
- EmptyPasswordRule-regular_expression_of_password_name = (?-mix:pass(word|_|$)|pwd)
22
-
23
- [InvalidIPAddrBindingRule]
24
- InvalidIPAddrBindingRule-enable_configuration = true
25
- InvalidIPAddrBindingRule-regular_expression_of_an_invalid_ip_address = (?-mix:^((http(s)?:\/\/)?0.0.0.0(:\d{1,5})?)$)
26
-
27
- [UseWeakCryptoAlgorithmsRule]
28
- UseWeakCryptoAlgorithmsRule-enable_configuration = true
29
- UseWeakCryptoAlgorithmsRule-regular_expression_of_weak_crypto_algorithms = (?-mix:^(sha1|md5))
30
-
31
- [SuspiciousCommentRule]
32
- SuspiciousCommentRule-enable_configuration = true
33
- SuspiciousCommentRule-list_of_trigger_words = hack,fixme,later,later2,todo,ticket,launchpad,bug,to-do
34
- SuspiciousCommentRule-regular_expression_of_keywords_present_in_suspicious_comments = (?-mix:hack|fixme|ticket|bug|secur|debug|defect|weak)
35
-
36
- [CyrillicHomographAttack]
37
- CyrillicHomographAttack-enable_configuration = true
38
- CyrillicHomographAttack-regular_expression_of_links_with_cyrillic_characters = (?-mix:^(http(s)?:\/\/)?.*\p{Cyrillic}+)
39
-
data/lib/test.txt DELETED
@@ -1,15 +0,0 @@
1
- jiuhiuhiuh
2
- ouhiuhiuh
3
- iuhiuh
4
- iuhiuhkokok
5
- kokokokokokokowdijwoidjqwoidjqwodijqdoiqjwdodij
6
- qwdqwd
7
- qwdqwddq
8
- wd
9
- qwdqwdoijoijoijoij
10
- oijoijoijoij
11
- kkkkkkkk
12
- huiuhiuhiuh
13
-
14
- kkjjjm
15
- okpokpok,l,l,l
data/lib/test2.rb DELETED
@@ -1,16 +0,0 @@
1
- require 'rjr/nodes/ws'
2
-
3
- # listen for methods via amqp, websockets, http, and via local calls
4
-
5
- ws_node = RJR::Nodes::WS.new :node_id => 'server', :host => '127.0.0.1', :port => 5007
6
-
7
-
8
- # define a rpc method called 'hello' which takes
9
- # one argument and returns it in upper case
10
- ws_node.dispatcher.handle("initialize") { |processId,clientInfo,locale,rootPath,rootUri,capabilities,trace,workspaceFolders|
11
- arg.upcase
12
- }
13
-
14
- # start the server and block
15
- ws_node.listen
16
- ws_node.join
data/lib/test3.rb DELETED
@@ -1,32 +0,0 @@
1
- require 'socket' # Get sockets from stdlib
2
- require 'json'
3
-
4
- server = TCPServer.open(5007) # Socket to listen on port 2000
5
-
6
- loop {
7
- Thread.fork(server.accept) do |client|
8
- while line=client.gets
9
- length=Integer(line.scan(/\d/).join(''))
10
- line=client.read(length+2)
11
- request = JSON.parse(line)
12
- puts line
13
-
14
- response = {
15
- jsonrpc: request['jsonrpc'],
16
- result: {
17
- capabilities: {
18
- textDocumentSync:1
19
- }
20
- },
21
- id: request['id']
22
- }
23
-
24
- response = JSON.generate(response)
25
-
26
- client.flush
27
- client.puts("Content-Length: "+response.length.to_s+"\r\n\r\n")
28
- client.puts(response)
29
- end
30
- client.close
31
- end
32
- }
data/lib/test_new.rb DELETED
@@ -1,19 +0,0 @@
1
- require 'jimson'
2
-
3
- class MyHandler
4
- extend Jimson::Handler
5
-
6
- def initi(a,b)
7
- a + b
8
- end
9
-
10
- def initialize
11
- super
12
- end
13
-
14
- end
15
-
16
- server = Jimson::Server.new(MyHandler.new)
17
- server.port = 5007
18
- server.host = '127.0.0.1'
19
- server.start # serve with webrick on http://0.0.0.0:8999/
Binary file
Binary file
Binary file