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

Added testssl attack #148

Merged
merged 44 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
55388f0
Added very simple wrapper around testssl
gammelalf Dec 19, 2023
3abb3eb
Added more options to testssl
gammelalf Dec 20, 2023
9511613
Propageted the new testssl attack through the entire rpc-http chain
gammelalf Dec 21, 2023
b19c421
Made testssl run in dev environment
gammelalf Dec 21, 2023
7b7537f
Send testssl results over grpc and aggregate into a service
gammelalf Dec 22, 2023
9b00d88
Store a testssl attack's most basic results
gammelalf Dec 22, 2023
b1e7c21
Updated frontend SDK to testssl
gammelalf Dec 22, 2023
60e2dc6
Merge branch 'main' into testssl
gammelalf Jan 11, 2024
b68d745
Merge branch 'main' into testssl
gammelalf Jan 11, 2024
c94df02
Added --experimental_allow_proto3_optional flag
gammelalf Jan 11, 2024
82d2041
Added scaffolding for Mitre ATT&CK categories
gammelalf Jan 15, 2024
70e09c3
Parse testssl findings' ids
gammelalf Jan 15, 2024
7854821
Removed Other variants
gammelalf Jan 15, 2024
d351440
Commited and documented mitre code generator
gammelalf Jan 15, 2024
536cf3b
Added conversion to and from string for mitre types
gammelalf Jan 17, 2024
012a9a9
Require port and ip for testssl attack
gammelalf Jan 22, 2024
9ac7987
Store testssl results in db
gammelalf Jan 22, 2024
6afce28
Documented finding ids
gammelalf Jan 22, 2024
c9eb4e8
Fixed clippy
gammelalf Jan 22, 2024
de13478
Merge branch 'main' into testssl
gammelalf Jan 22, 2024
b4975f0
Added testssl attack form
gammelalf Jan 23, 2024
a17d895
Show raw testssl results in details panel
gammelalf Jan 23, 2024
f1cb977
Merge branch 'main' into testssl
gammelalf Jan 24, 2024
0c05422
Made migrations work on production db
gammelalf Jan 24, 2024
4de598f
Fixed missing merge
gammelalf Jan 24, 2024
26f267e
Merge branch 'main' into testssl
gammelalf Jan 24, 2024
4377579
Removed accedently commited files
gammelalf Jan 24, 2024
ce88f42
Removed mitre and applied other requested changes
gammelalf Jan 24, 2024
9d7a586
Merge branch 'main' into testssl
gammelalf Aug 27, 2024
497c5de
Fixed attacking http services
gammelalf Aug 27, 2024
822f03b
Updated formatting of imports in testssl code
gammelalf Aug 27, 2024
0cca13d
Added StartTLS to frontend
gammelalf Aug 27, 2024
59a352b
Attach testssl results to services without creating them
gammelalf Aug 28, 2024
e08d441
Made domain optional in testssl attacks
gammelalf Aug 28, 2024
4751727
Display attack parameters in results page
gammelalf Aug 28, 2024
bedde03
Aggregate testssl into services and their targets' domain
gammelalf Aug 29, 2024
58a8424
Merge branch 'main' into testssl
gammelalf Sep 5, 2024
85b183d
Fixed broken join
gammelalf Sep 5, 2024
8319df2
Renamed hexagon; Re-enabled "Ports" hexagon
gammelalf Sep 5, 2024
9919eeb
Re-added accidentially deleted raw migration
gammelalf Sep 5, 2024
4b5f395
Forced testssl to not perform any dns on its own
gammelalf Sep 5, 2024
4cd664c
Fixed starttls
gammelalf Sep 6, 2024
c573a98
Fixed clippy lints
gammelalf Sep 6, 2024
3fb92b3
Made TestSSLResultFinding point to TestSSLResultHeader instead of Attack
gammelalf Sep 6, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.idea/
.vagrant/
venv/
__pycache__/

vagrant/vars.yml
.models.json
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

223 changes: 223 additions & 0 deletions kraken-proto/proto/attacks.proto
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,224 @@ message OsDetectionResponse {
repeated string versions = 4;
}

/*
* testssl.sh
*/

// Request for running testssl.sh
message TestSSLRequest {
// A unique id that identifier the attack
string attack_uuid = 1;
// The domain used for SNI and cert validity check
optional string domain = 2;
// The ip address to scan
shared.Address ip = 3;
// The port to scan
uint32 port = 4;
// Timeout for TCP handshakes in seconds
optional uint64 connect_timeout = 5;
// Timeout for `openssl` connections in seconds
optional uint64 openssl_timeout = 6;
// Enable ip v6
optional bool v6 = 7;
// Set the `BASICAUTH` header when checking http headers
optional BasicAuth basic_auth = 8;
// Run against a STARTTLS enabled protocol
optional StartTLSProtocol starttls = 9;
// Which scans `testssl.sh` should run
optional TestSSLScans scans = 10;
}

// The `BASICAUTH` header
message BasicAuth {
// The username
string username = 1;
// The password
string password = 2;
}

// Protocols to select from when using `testssl.sh`'s `--starttls` option
enum StartTLSProtocol {
// FTP
FTP = 0;
// SMTP
SMTP = 1;
// POP3
POP3 = 2;
// IMAP
IMAP = 3;
// XMPP
XMPP = 4;
// LMTP
LMTP = 5;
// NNTP
NNTP = 6;
// Postgres
Postgres = 7;
// MySQL
MySQL = 8;
}

/// Config option which scans `testssl.sh` should run
message TestSSLScans {
// Workaround field to store a `oneof`
oneof testssl_scans {
// Either run all scans or just the default ones
bool all = 1;

// Select the scans to run manually
TestSSLScansManual manual = 2;
}
}

// Select the scans to run manually
//
// Each field (except `cipher_tests_...`) correspond directly to a section in `testssl.sh`'s output
message TestSSLScansManual {
/// Enables [`ScanResult`]'s `protocols` section
bool protocols = 1;

/// Enables [`ScanResult`]'s `grease` section
bool grease = 2;

/// Enables [`ScanResult`]'s `ciphers` section
bool ciphers = 3;

/// Enables [`ScanResult`]'s `pfs` section
bool pfs = 4;

/// Enables [`ScanResult`]'s `server_preferences` section
bool server_preferences = 5;

/// Enables [`ScanResult`]'s `server_defaults` section
bool server_defaults = 6;

/// Enables [`ScanResult`]'s `header_response` section
bool header_response = 7;

/// Enables [`ScanResult`]'s `vulnerabilities` section
bool vulnerabilities = 8;

/// Enables [`ScanResult`]'s `cipher_tests` section
bool cipher_tests_all = 9;

/// Enables [`ScanResult`]'s `cipher_tests` section
bool cipher_tests_per_proto = 10;

/// Enables [`ScanResult`]'s `browser_simulations` section
bool browser_simulations = 11;
}

// Response to a test ssl request
message TestSSLResponse {
// The services' scan results or their errors
repeated TestSSLService services = 1;
}

// A service's scan results or an error
message TestSSLService {
// Workaround field to store a `oneof`
oneof testssl_service {
// The result from scanning a service
TestSSLScanResult result = 1;

// Some error prevented a service from being scanned
TestSSLFinding error = 2;
}
}

// A service's scan results
message TestSSLScanResult {
// The original user target this result belongs to
string target_host = 1;

// The scanned ip address
string ip = 2;

// The scanned port
string port = 3;

// The detected service
string service = 5;

// TODO: not found yet in the wild
// optional string hostname = 6;

// Some sanity checks which can't be disabled
repeated TestSSLFinding pretest = 7;

// Which tls protocols are supported
repeated TestSSLFinding protocols = 8;

// Server implementation bugs and [GREASE](https://www.ietf.org/archive/id/draft-ietf-tls-grease-01.txt)
repeated TestSSLFinding grease = 9;

// Which cipher suites are supported
repeated TestSSLFinding ciphers = 10;

// Checks robust (perfect) forward secrecy key exchange
repeated TestSSLFinding pfs = 11;

// The server's preferences
repeated TestSSLFinding server_preferences = 12;

// The server's defaults
repeated TestSSLFinding server_defaults = 13;

// The http header set by the server
repeated TestSSLFinding header_response = 14;

// List of several vulnerabilities
repeated TestSSLFinding vulnerabilities = 15;

// Which concrete ciphers are supported
//
// Depending on the option `testssl` is invoked with,
// this is either a list of all ciphers or a list of all cipher per tls protocol.
repeated TestSSLFinding cipher_tests = 16;

// Which browser is able to establish a connection
repeated TestSSLFinding browser_simulations = 17;
}

// A single test's result or testssl log message
message TestSSLFinding {
// The test's id
string id = 1;
// The result's severity
TestSSLSeverity severity = 2;
// The test's result
string finding = 3;

// The associated CVE
optional string cve = 4;
// The associated CWE
optional string cwe = 5;
}

// A TestSSLFinding's severity
enum TestSSLSeverity {
// A debug level log message
Debug = 0;
// An info level log message
Info = 1;
// A warning level log message
Warn = 2;
// An error level log message
Fatal = 3;

// The test's result doesn't pose an issue
Ok = 4;
// The test's result pose a low priority issue
Low = 5;
// The test's result pose a medium priority issue
Medium = 6;
// The test's result pose a high priority issue
High = 7;
// The test's result pose a critical priority issue
Critical = 8;
}

// Implemented by leech; allows kraken to request attack from a leech
service ReqAttackService {
rpc BruteforceSubdomains(BruteforceSubdomainRequest) returns (stream BruteforceSubdomainResponse);
Expand All @@ -283,6 +501,7 @@ service ReqAttackService {
rpc DnsResolution(DnsResolutionRequest) returns (stream DnsResolutionResponse);
rpc DnsTxtScan(DnsTxtScanRequest) returns (stream DnsTxtScanResponse);
rpc OsDetection(OsDetectionRequest) returns (stream OsDetectionResponse);
rpc TestSSL(TestSSLRequest) returns (TestSSLResponse);
}

/*
Expand Down Expand Up @@ -315,6 +534,8 @@ message PushAttackRequest {
RepeatedDnsTxtScanResponse dns_txt_scan = 10;
// Response to a operating system detection request
RepeatedOsDetectionResponse os_detection = 11;
// Response for running testssl.sh
TestSSLResponse testssl = 12;
}
}

Expand Down Expand Up @@ -405,6 +626,8 @@ message AnyAttackResponse {
DnsTxtScanResponse dns_txt_scan = 9;
// Response to a operating system detection request
OsDetectionResponse os_detection = 10;
// Response for running testssl.sh
TestSSLResponse testssl = 11;
}
}

Expand Down
2 changes: 1 addition & 1 deletion kraken-proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub use generated::*;

mod convert;

#[allow(clippy::unwrap_used, clippy::expect_used)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::large_enum_variant)]
mod generated {

/// The autogenerated rpc definitions from `attacks.shared.proto`
Expand Down
4 changes: 3 additions & 1 deletion kraken/migrations/0001_initial.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Value = [
"OSDetection",
"VersionDetection",
"AntiPortScanningDetection",
"TestSSL",
]

[[Migration.Operations.Fields.Annotations]]
Expand Down Expand Up @@ -1335,6 +1336,7 @@ Value = [
"OSDetection",
"VersionDetection",
"AntiPortScanningDetection",
"TestSSL",
"ManualDomain",
"ManualHost",
"ManualPort",
Expand Down Expand Up @@ -3582,4 +3584,4 @@ OnDelete = "Cascade"
OnUpdate = "Cascade"

[[Migration.Operations.Field.Annotations]]
Type = "not_null"
Type = "not_null"
Loading
Loading