Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Create separate finding for Microsoft RDP port #3882

Merged
merged 31 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
351d42c
BoefjeResources now only create their module when they are not a
Souf149 Oct 4, 2024
6530037
Check if boefje is a docker-boefje first and then if path exists
Souf149 Oct 7, 2024
282061f
Merge branch 'main' into main
Souf149 Oct 7, 2024
54741ed
Merge branch 'main' of https://github.com/minvws/nl-kat-coordination
stephanie0x00 Oct 7, 2024
a5859f1
Merge branch 'main' of https://github.com/minvws/nl-kat-coordination
stephanie0x00 Oct 8, 2024
f23b832
Merge branch 'main' of https://github.com/minvws/nl-kat-coordination
stephanie0x00 Oct 10, 2024
b652e93
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Oct 30, 2024
628cfdf
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Oct 31, 2024
1f2a764
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Nov 4, 2024
1f7700e
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Nov 4, 2024
0ebe99c
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Nov 14, 2024
e7526f4
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Nov 20, 2024
28d1a55
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Nov 20, 2024
bbcd78b
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Nov 21, 2024
bb5f71c
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Nov 21, 2024
8bf3368
Merge branch 'main' of ssh+git://github.com/minvws/nl-kat-coordination
stephanie0x00 Nov 25, 2024
6cba8d1
Update findingsDB and tweak bit for separate RDP port
stephanie0x00 Nov 25, 2024
1639424
Update severity
stephanie0x00 Nov 25, 2024
c2fe379
Update question schema
stephanie0x00 Nov 26, 2024
105d91d
Update port_classification_ip.py
stephanie0x00 Nov 26, 2024
9b20e00
Merge branch 'main' into fix/add-separate-rdp-finding
Rieven Nov 26, 2024
6bf6118
Fixed tests and formatting
ammar92 Nov 26, 2024
3a7c7ef
Fixed test
ammar92 Nov 26, 2024
4532b5a
Fixed test
ammar92 Nov 26, 2024
b765240
Merge remote-tracking branch 'origin/fix/add-separate-rdp-finding' in…
ammar92 Nov 26, 2024
53cc2c1
Merge branch 'main' into fix/add-separate-rdp-finding
Rieven Nov 26, 2024
ba8a093
Merge branch 'main' into fix/add-separate-rdp-finding
underdarknl Nov 27, 2024
41a9891
Merge branch 'main' into fix/add-separate-rdp-finding
underdarknl Nov 27, 2024
3f7a063
Merge branch 'main' into fix/add-separate-rdp-finding
underdarknl Nov 27, 2024
21ee691
Update octopoes/bits/port_classification_ip/port_classification_ip.py
noamblitz Nov 28, 2024
da3dd3f
Merge branch 'main' into fix/add-separate-rdp-finding
underdarknl Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@
"impact": "System administrator ports should only be reachable from safe and known locations to reduce attack surface.",
"recommendation": "Determine if this port should be reachable from the identified location. Limit access to reduce the attack surface if necessary."
},
"KAT-REMOTE-DESKTOP-PORT": {
"description": "An open Microsoft Remote Desktop Protocol (RDP) port was detected.",
"source": "https://www.cloudflare.com/en-gb/learning/access-management/rdp-security-risks/",
"risk": "medium",
"impact": "Remote desktop ports are often the root cause in ransomware attacks, due to weak password usage, outdated software or insecure configurations.",
"recommendation": "Disable the Microsoft RDP service on port 3389 if this is publicly reachable. Add additional security layers, such as VPN access if these ports do require to be enabled to limit the attack surface."
},
"KAT-OPEN-DATABASE-PORT": {
"description": "A database port is open.",
"source": "https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers",
Expand Down
6 changes: 6 additions & 0 deletions octopoes/bits/ask_port_specification/question_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
"pattern": "^(\\s*(,*)[0-9]+,?\\s*)*$",
"default": "1433,1434,3050,3306,5432"
},
"microsoft_rdp_ports": {
"description": "Comma separated list of (Microsoft) RDP ports",
"type": "string",
"pattern": "^(\\s*(,*)[0-9]+,?\\s*)*$",
"default": "3389"
},
"aggregate_findings": {
"description": "Do you want to aggregate findings into one finding of the IP? Answer with true or false.",
"type": "string",
Expand Down
20 changes: 18 additions & 2 deletions octopoes/bits/port_classification_ip/port_classification_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
21, # FTP
22, # SSH
23, # Telnet
3389, # Remote Desktop
5900, # VNC
]
DB_TCP_PORTS = [
Expand All @@ -36,6 +35,9 @@
3306, # MySQL
5432, # PostgreSQL
]
MICROSOFT_RDP_PORTS = [
3389 # Microsoft Remote Desktop
]


def get_ports_from_config(config, config_key, default):
Expand All @@ -53,6 +55,7 @@ def run(input_ooi: IPPort, additional_oois: list, config: dict[str, Any]) -> Ite
common_udp_ports = get_ports_from_config(config, "common_udp_ports", COMMON_UDP_PORTS)
sa_tcp_ports = get_ports_from_config(config, "sa_tcp_ports", SA_TCP_PORTS)
db_tcp_ports = get_ports_from_config(config, "db_tcp_ports", DB_TCP_PORTS)
microsoft_rdp_ports = get_ports_from_config(config, "microsoft_rdp_ports", MICROSOFT_RDP_PORTS)

for ip_port in additional_oois:
port = ip_port.port
Expand All @@ -66,7 +69,8 @@ def run(input_ooi: IPPort, additional_oois: list, config: dict[str, Any]) -> Ite
yield Finding(
finding_type=open_sa_port.reference,
ooi=ip_port.reference,
description=f"Port {port}/{protocol.value} is a system administrator port and should not be open.",
description=f"Port {port}/{protocol.value} is a system administrator port and "
f"should possibly not be open.",
)
elif protocol == Protocol.TCP and port in db_tcp_ports:
ft = KATFindingType(id="KAT-OPEN-DATABASE-PORT")
Expand All @@ -79,6 +83,18 @@ def run(input_ooi: IPPort, additional_oois: list, config: dict[str, Any]) -> Ite
ooi=ip_port.reference,
description=f"Port {port}/{protocol.value} is a database port and should not be open.",
)
elif (protocol == Protocol.TCP or protocol == Protocol.UDP) and port in microsoft_rdp_ports:
noamblitz marked this conversation as resolved.
Show resolved Hide resolved
open_rdp_port = KATFindingType(id="KAT-REMOTE-DESKTOP-PORT")
if aggregate_findings:
open_ports.append(ip_port.port)
else:
yield open_rdp_port
yield Finding(
finding_type=open_rdp_port.reference,
ooi=ip_port.reference,
description=f"Port {port}/{protocol.value} is a Microsoft Remote Desktop port and "
f"should possibly not be open.",
)
elif (protocol == Protocol.TCP and port not in common_tcp_ports) or (
protocol == Protocol.UDP and port not in common_udp_ports
):
Expand Down
2 changes: 1 addition & 1 deletion octopoes/tests/test_bit_ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_port_classification_tcp_22():
assert len(results) == 2
finding = results[-1]
assert isinstance(finding, Finding)
assert finding.description == "Port 22/tcp is a system administrator port and should not be open."
assert finding.description == "Port 22/tcp is a system administrator port and should possibly not be open."


def test_port_classification_tcp_5432():
Expand Down