File tree Expand file tree Collapse file tree 3 files changed +56
-26
lines changed
assets/queries/terraform/aws/unknown_port_exposed_to_internet/test Expand file tree Collapse file tree 3 files changed +56
-26
lines changed Original file line number Diff line number Diff line change 1
1
resource "aws_security_group" "negative1-1" {
2
- name = " allow_tls"
3
- description = " Allow TLS inbound traffic"
4
- vpc_id = aws_vpc. main . id
5
2
6
3
ingress {
7
- description = " TLS from VPC "
8
- from_port = 443
9
- to_port = 443
4
+ description = " Remote desktop open private "
5
+ from_port = 2383
6
+ to_port = 2383
10
7
protocol = " tcp"
8
+ cidr_blocks = [" 192.168.0.0/24" , " 0.0.0.0/0" ]
11
9
}
12
10
}
13
11
14
12
resource "aws_security_group" "negative1-2" {
15
13
16
14
ingress {
17
15
description = " Remote desktop open private"
18
- from_port = 2383
19
- to_port = 2383
16
+ from_port = 20
17
+ to_port = 20
20
18
protocol = " tcp"
21
- cidr_blocks = [" 192.168.0.0/24 " , " 192.162.0.0/24 " ]
19
+ ipv6_cidr_blocks = [" ::/0 " ]
22
20
}
23
21
}
24
22
25
23
resource "aws_security_group" "negative1-3" {
26
24
27
25
ingress {
28
26
description = " Remote desktop open private"
29
- from_port = 20
30
- to_port = 20
27
+ from_port = 0
28
+ to_port = 10000
29
+ protocol = " tcp"
30
+ cidr_blocks = [" 192.168.0.0/24" , " 192.201.0.0/12" ]
31
+ }
32
+ }
33
+
34
+ resource "aws_security_group" "negative1-4" {
35
+
36
+ ingress {
37
+ description = " Remote desktop open private"
38
+ from_port = 0
39
+ to_port = 10000
31
40
protocol = " tcp"
32
41
ipv6_cidr_blocks = [" 2001:db8:abcd:0012::/64" ]
33
42
}
Original file line number Diff line number Diff line change @@ -6,26 +6,37 @@ resource "aws_security_group" "negative2" {
6
6
7
7
resource "aws_vpc_security_group_ingress_rule" "negative2-1" {
8
8
security_group_id = aws_security_group. negative3 . id
9
- from_port = 443
10
- to_port = 443
9
+ from_port = 2383
10
+ to_port = 2383
11
11
ip_protocol = " tcp"
12
- description = " TLS from VPC"
12
+ cidr_ipv4 = " 0.0.0.0/0"
13
+ description = " Remote desktop open private"
13
14
}
14
15
16
+
15
17
resource "aws_vpc_security_group_ingress_rule" "negative2-2" {
16
18
security_group_id = aws_security_group. negative3 . id
17
- from_port = 2383
18
- to_port = 2383
19
+ from_port = 20
20
+ to_port = 20
21
+ ip_protocol = " tcp"
22
+ cidr_ipv6 = " ::/0"
23
+ description = " Remote desktop open private"
24
+ }
25
+
26
+ resource "aws_vpc_security_group_ingress_rule" "negative2-3" {
27
+ security_group_id = aws_security_group. negative3 . id
28
+ from_port = 0
29
+ to_port = 10000
19
30
ip_protocol = " tcp"
20
31
cidr_ipv4 = " 192.168.0.0/24"
21
32
description = " Remote desktop open private"
22
33
}
23
34
24
35
25
- resource "aws_vpc_security_group_ingress_rule" "negative2-3 " {
36
+ resource "aws_vpc_security_group_ingress_rule" "negative2-4 " {
26
37
security_group_id = aws_security_group. negative3 . id
27
- from_port = 20
28
- to_port = 20
38
+ from_port = 0
39
+ to_port = 10000
29
40
ip_protocol = " tcp"
30
41
cidr_ipv6 = " 2001:db8:abcd:0012::/64"
31
42
description = " Remote desktop open private"
Original file line number Diff line number Diff line change @@ -6,25 +6,35 @@ resource "aws_security_group" "negative3" {
6
6
7
7
resource "aws_security_group_rule" "negative3-1" {
8
8
type = " ingress"
9
- from_port = 443
10
- to_port = 443
9
+ from_port = 2383
10
+ to_port = 2383
11
11
protocol = " tcp"
12
+ cidr_blocks = [" 192.168.0.0/24" , " 0.0.0.0/0" ]
12
13
security_group_id = aws_security_group. negative3 . id
13
14
}
14
15
15
16
resource "aws_security_group_rule" "negative3-2" {
16
17
type = " ingress"
17
- from_port = 2383
18
- to_port = 2383
18
+ from_port = 20
19
+ to_port = 20
19
20
protocol = " tcp"
20
- cidr_blocks = [" 192.168.0.0/24 " , " 192.162.0.0/24 " ]
21
+ ipv6_cidr_blocks = [" ::/0 " ]
21
22
security_group_id = aws_security_group. negative3 . id
22
23
}
23
24
24
25
resource "aws_security_group_rule" "negative3-3" {
25
26
type = " ingress"
26
- from_port = 20
27
- to_port = 20
27
+ from_port = 0
28
+ to_port = 10000
29
+ protocol = " tcp"
30
+ cidr_blocks = [" 192.168.0.0/24" , " 192.162.0.0/24" ]
31
+ security_group_id = aws_security_group. negative3 . id
32
+ }
33
+
34
+ resource "aws_security_group_rule" "negative3-4" {
35
+ type = " ingress"
36
+ from_port = 0
37
+ to_port = 10000
28
38
protocol = " tcp"
29
39
ipv6_cidr_blocks = [" 2001:db8:abcd:0012::/64" ]
30
40
security_group_id = aws_security_group. negative3 . id
You can’t perform that action at this time.
0 commit comments