Skip to content

Commit 6f2d956

Browse files
authored
Merge pull request #14 from RUB-NDS/moreAttack
More attack
2 parents d06add7 + 4d2896b commit 6f2d956

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3173
-643
lines changed

README.md

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TLS-Scanner is a tool created by the Chair for Network and Data Security from th
44
**Please note:** *TLS-Scanner is a research tool intended for TLS developers, pentesters, administrators and researchers. There is no GUI. It is in the first version and may contain some bugs.*
55

66
# Compiling
7-
In order to compile and use TLS-Scanner, you need to have Java installed, as well as [TLS-Attacker](https://github.com/RUB-NDS/TLS-Attacker) in Version 2.1
7+
In order to compile and use TLS-Scanner, you need to have Java installed, as well as [TLS-Attacker](https://github.com/RUB-NDS/TLS-Attacker) in Version 2.2
88

99
```bash
1010
$ cd TLS-Scanner
@@ -23,7 +23,7 @@ $ ./mvnw clean install
2323

2424
For hints on installing the required libraries checkout the corresponding GitHub repositories.
2525

26-
**Please note:** *In order to run this tool you need TLS-Attacker version 2.1*
26+
**Please note:** *In order to run this tool you need TLS-Attacker version 2.2*
2727

2828
# Running
2929
In order to run TLS-Scanner you need to run the jar file in the apps/ folder.
@@ -33,39 +33,3 @@ $ java -jar apps/TLS-Scanner.jar -connect localhost:4433
3333
```
3434

3535
You can specify a host you want to scan with the -connect parameter. If you want to improve the performance of the scan you can use the -threads parameter (default=1).
36-
37-
38-
# Results
39-
TLS-Scanner uses the concept of "checks" which are performed after it collected configuration information. A check which results in "true" is consideres a non optimal choice and is an indicator for a pentester for a possible problem.
40-
41-
There are currently multiple checks implemented:
42-
43-
44-
| Check | Meaning |
45-
| ------------------------------- |:-----------------------------------------------------------------------------:|
46-
| CERTIFICATE_EXPIRED | Checks if the Certificate is expired yet |
47-
| CERTIFICATE_NOT_VALID_YET | Checks if the Certificate is valid yet |
48-
| CERTIFICATE_WEAK_HASH_FUNCTION | Checks if the Server uses a weak Hash algorithm for its Certificate |
49-
| CERTIFICATE_WEAK_SIGN_ALGORITHM | Checks if the Server uses a weak Signature algorithm for its Certificate |
50-
| CERTIFICATE_NOT_SENT_BY_SERVER | Checks if the Server did sent a Certificate at all |
51-
| CIPHERSUITE_ANON | Checks if the Server has Anon Ciphersuites enabled |
52-
| CIPHERSUITE_CBC | Checks if the Server has CBC Ciphersuites enabled for TLS 1.0 |
53-
| CIPHERSUITE_EXPORT | Checks if the Server has Export Ciphersuites enabled |
54-
| CIPHERSUITE_NULL | Checks if the Server has Null Ciphersuites enabled |
55-
| CIPHERSUITE_RC4 | Checks if the Server has RC4 Ciphersuites enabled |
56-
| CIPHERSUITEORDER_ENFORCED | Checks if the Server does not enforce a Ciphersuite ordering |
57-
| PROTOCOLVERSION_SSL2 | Checks if SSL 2 is enabled |
58-
| PROTOCOLVERSION_SSL3 | Checks if SSL 3 is enabled |
59-
| ATTACK_HEARTBLEED | Checks if the Server is vulnerable to Heartbleed |
60-
| ATTACK_PADDING | Checks if the Server is vulnerable to a Padding_Oracle Attack (BETA) |
61-
| ATTACK_BLEICHENBACHER | Checks if the Server is vulnerable to the Bleichenbacher Attack (BETA) |
62-
| ATTACK_POODLE | Checks if the Server is vulnerable to the Poodle Attack (BETA) |
63-
| ATTACK_TLS_POODLE | Checks if the Server is vulnerable to the TLS variant of Poolde (BETA) |
64-
| ATTACK_CVE20162107 | Checks if the Server is vulnerable to CVE20162107 (BETA) y |
65-
| ATTACK_INVALID_CURVE | Checks if the Server is vulnerable to the Invalid Curve Attack (BETA) |
66-
| ATTACK_INVALID_CURVE_EPHEMERAL | Checks if the Server is vulnerable to an Ephemeral Invalid Curve Attack(BETA) |
67-
68-
69-
70-
71-
**Please note:** *A check with a _result_ of true is considered non optimal*

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
<dependency>
1010
<groupId>de.rub.nds.tlsattacker</groupId>
1111
<artifactId>TLS-Core</artifactId>
12-
<version>2.1</version>
12+
<version>2.2</version>
1313
</dependency>
1414
<dependency>
1515
<groupId>de.rub.nds.tlsattacker</groupId>
1616
<artifactId>Attacks</artifactId>
17-
<version>2.1</version>
17+
<version>2.2</version>
1818
</dependency>
1919
<dependency>
2020
<groupId>junit</groupId>

src/main/java/de/rub/nds/tlsscanner/Main.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static void main(String[] args) throws IOException {
4343
}
4444
// Cmd was parsable
4545
try {
46-
TLSScanner scanner = new TLSScanner(config);
46+
TlsScanner scanner = new TlsScanner(config);
4747
long time = System.currentTimeMillis();
4848
LOGGER.info("Performing Scan, this may take some time...");
4949
SiteReport report = scanner.scan();
@@ -71,7 +71,7 @@ public static void scanFile(File f) throws FileNotFoundException, IOException
7171
while((line = reader.readLine()) != null)
7272
{
7373
String host = line.split(",")[2];
74-
TLSScanner scanner = new TLSScanner(host,false);
74+
TlsScanner scanner = new TlsScanner(host,false);
7575
scanner.scan();
7676
}
7777
System.exit(0);

src/main/java/de/rub/nds/tlsscanner/ScanJob.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
*/
99
package de.rub.nds.tlsscanner;
1010

11-
import de.rub.nds.tlsscanner.probe.TLSProbe;
11+
import de.rub.nds.tlsscanner.probe.TlsProbe;
12+
import de.rub.nds.tlsscanner.report.after.AfterProbe;
13+
import java.util.LinkedList;
1214
import java.util.List;
1315

1416
/**
@@ -17,13 +19,19 @@
1719
*/
1820
public class ScanJob {
1921

20-
private final List<TLSProbe> probeList;
22+
private final List<TlsProbe> probeList;
23+
private final List<AfterProbe> afterList;
2124

22-
public ScanJob(List<TLSProbe> testList) {
25+
public ScanJob(List<TlsProbe> testList, List<AfterProbe> afterList) {
2326
this.probeList = testList;
27+
this.afterList = afterList;
2428
}
2529

26-
public List<TLSProbe> getProbeList() {
30+
public List<TlsProbe> getProbeList() {
2731
return probeList;
2832
}
33+
34+
public List<AfterProbe> getAfterProbes() {
35+
return afterList;
36+
}
2937
}

src/main/java/de/rub/nds/tlsscanner/ScanJobExecutor.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111
import de.rub.nds.tlsattacker.core.config.delegate.ClientDelegate;
1212
import de.rub.nds.tlsscanner.config.ScannerConfig;
13-
import de.rub.nds.tlsscanner.report.ProbeResult;
13+
import de.rub.nds.tlsscanner.report.result.ProbeResult;
1414
import de.rub.nds.tlsscanner.report.SiteReport;
15-
import de.rub.nds.tlsscanner.probe.TLSProbe;
15+
import de.rub.nds.tlsscanner.probe.TlsProbe;
16+
import de.rub.nds.tlsscanner.report.after.AfterProbe;
1617
import java.util.LinkedList;
1718
import java.util.List;
1819
import java.util.concurrent.ExecutionException;
@@ -38,7 +39,7 @@ public ScanJobExecutor(int threadCount) {
3839

3940
public SiteReport execute(ScannerConfig config, ScanJob scanJob) {
4041
List<Future<ProbeResult>> futureResults = new LinkedList<>();
41-
for (TLSProbe probe : scanJob.getProbeList()) {
42+
for (TlsProbe probe : scanJob.getProbeList()) {
4243
futureResults.add(executor.submit(probe));
4344
}
4445
List<ProbeResult> resultList = new LinkedList<>();
@@ -54,6 +55,15 @@ public SiteReport execute(ScannerConfig config, ScanJob scanJob) {
5455
executor.shutdown();
5556
ClientDelegate clientDelegate = (ClientDelegate) config.getDelegate(ClientDelegate.class);
5657
String hostname = clientDelegate.getHost();
57-
return new SiteReport(hostname, resultList);
58+
SiteReport report = new SiteReport(hostname);
59+
report.setServerIsAlive(Boolean.TRUE);
60+
for (ProbeResult result : resultList) {
61+
result.merge(report);
62+
}
63+
for(AfterProbe afterProbe : scanJob.getAfterProbes())
64+
{
65+
afterProbe.analyze(report);
66+
}
67+
return report;
5868
}
5969
}

src/main/java/de/rub/nds/tlsscanner/TLSScanner.java renamed to src/main/java/de/rub/nds/tlsscanner/TlsScanner.java

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,45 @@
88
*/
99
package de.rub.nds.tlsscanner;
1010

11+
import de.rub.nds.tlsattacker.attacks.connectivity.ConnectivityChecker;
12+
import de.rub.nds.tlsattacker.core.config.Config;
1113
import de.rub.nds.tlsattacker.core.config.delegate.ClientDelegate;
1214
import de.rub.nds.tlsattacker.core.config.delegate.GeneralDelegate;
1315
import de.rub.nds.tlsscanner.config.ScannerConfig;
1416
import de.rub.nds.tlsscanner.probe.BleichenbacherProbe;
15-
import de.rub.nds.tlsscanner.report.SiteReport;
1617
import de.rub.nds.tlsscanner.probe.CertificateProbe;
1718
import de.rub.nds.tlsscanner.probe.CiphersuiteOrderProbe;
1819
import de.rub.nds.tlsscanner.probe.CiphersuiteProbe;
20+
import de.rub.nds.tlsscanner.probe.CompressionsProbe;
1921
import de.rub.nds.tlsscanner.probe.Cve20162107Probe;
22+
import de.rub.nds.tlsscanner.probe.ExtensionProbe;
2023
import de.rub.nds.tlsscanner.probe.HeartbleedProbe;
2124
import de.rub.nds.tlsscanner.probe.InvalidCurveProbe;
25+
import de.rub.nds.tlsscanner.probe.NamedCurvesProbe;
2226
import de.rub.nds.tlsscanner.probe.PaddingOracleProbe;
2327
import de.rub.nds.tlsscanner.probe.PoodleProbe;
28+
import de.rub.nds.tlsscanner.report.SiteReport;
2429
import de.rub.nds.tlsscanner.probe.ProtocolVersionProbe;
25-
import de.rub.nds.tlsscanner.probe.TLSProbe;
2630
import de.rub.nds.tlsscanner.probe.TlsPoodleProbe;
31+
import de.rub.nds.tlsscanner.probe.TlsProbe;
32+
import de.rub.nds.tlsscanner.report.after.AfterProbe;
33+
import de.rub.nds.tlsscanner.report.after.DrownAfterProbe;
34+
import de.rub.nds.tlsscanner.report.after.Sweet32AfterProbe;
2735
import java.util.LinkedList;
2836
import java.util.List;
2937
import org.apache.logging.log4j.Level;
30-
import org.apache.logging.log4j.LogManager;
31-
import org.apache.logging.log4j.core.LoggerContext;
32-
import org.apache.logging.log4j.core.config.Configuration;
3338
import org.apache.logging.log4j.core.config.Configurator;
34-
import org.apache.logging.log4j.core.config.LoggerConfig;
3539

3640
/**
3741
*
3842
* @author Robert Merget - [email protected]
3943
*/
40-
public class TLSScanner {
44+
public class TlsScanner {
4145

4246
private final ScanJobExecutor executor;
4347
private final ScannerConfig config;
4448

45-
public TLSScanner(String websiteHost, boolean attackingScans) {
49+
public TlsScanner(String websiteHost, boolean attackingScans) {
4650
this.executor = new ScanJobExecutor(1);
4751
config = new ScannerConfig(new GeneralDelegate());
4852
config.getGeneralDelegate().setLogLevel(Level.WARN);
@@ -51,7 +55,7 @@ public TLSScanner(String websiteHost, boolean attackingScans) {
5155
Configurator.setAllLevels("de.rub.nds.tlsattacker", Level.WARN);
5256
}
5357

54-
public TLSScanner(ScannerConfig config) {
58+
public TlsScanner(ScannerConfig config) {
5559
this.executor = new ScanJobExecutor(config.getThreads());
5660
this.config = config;
5761
if (config.getGeneralDelegate().getLogLevel() == Level.ALL) {
@@ -68,23 +72,39 @@ public TLSScanner(ScannerConfig config) {
6872
}
6973

7074
public SiteReport scan() {
71-
List<TLSProbe> testList = new LinkedList<>();
72-
testList.add(new CertificateProbe(config));
73-
testList.add(new ProtocolVersionProbe(config));
74-
testList.add(new CiphersuiteProbe(config));
75-
testList.add(new CiphersuiteOrderProbe(config));
76-
testList.add(new HeartbleedProbe(config));
77-
//testList.add(new NamedCurvesProbe(websiteHost));
78-
testList.add(new PaddingOracleProbe(config));
79-
testList.add(new BleichenbacherProbe(config));
80-
testList.add(new PoodleProbe(config));
81-
testList.add(new TlsPoodleProbe(config));
82-
testList.add(new Cve20162107Probe(config));
83-
testList.add(new InvalidCurveProbe(config));
84-
75+
List<TlsProbe> testList = new LinkedList<>();
76+
77+
if (prechecks()) {
78+
testList.add(new NamedCurvesProbe(config));
79+
testList.add(new CertificateProbe(config));
80+
testList.add(new ProtocolVersionProbe(config));
81+
testList.add(new CiphersuiteProbe(config));
82+
testList.add(new CiphersuiteOrderProbe(config));
83+
testList.add(new HeartbleedProbe(config));
84+
testList.add(new PaddingOracleProbe(config));
85+
testList.add(new BleichenbacherProbe(config));
86+
testList.add(new PoodleProbe(config));
87+
testList.add(new TlsPoodleProbe(config));
88+
testList.add(new Cve20162107Probe(config));
89+
testList.add(new InvalidCurveProbe(config));
90+
testList.add(new ExtensionProbe(config));
91+
testList.add(new CompressionsProbe(config));
92+
List<AfterProbe> afterList = new LinkedList<>();
93+
afterList.add(new Sweet32AfterProbe());
94+
afterList.add(new DrownAfterProbe());
95+
ScanJob job = new ScanJob(testList, afterList);
96+
return executor.execute(config, job);
97+
}
8598
// testList.add(new SignatureAndHashAlgorithmProbe(websiteHost));
86-
ScanJob job = new ScanJob(testList);
87-
return executor.execute(config, job);
99+
SiteReport report = new SiteReport(config.getClientDelegate().getHost());
100+
report.setServerIsAlive(false);
101+
return report;
102+
}
103+
104+
public boolean prechecks() {
105+
Config tlsConfig = config.createConfig();
106+
ConnectivityChecker checker = new ConnectivityChecker(tlsConfig.getDefaultClientConnection());
107+
return checker.isConnectable();
88108
}
89109

90110
}

src/main/java/de/rub/nds/tlsscanner/config/ScannerConfig.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import com.beust.jcommander.Parameter;
1212
import com.beust.jcommander.ParametersDelegate;
13+
import de.rub.nds.tlsattacker.core.config.Config;
1314
import de.rub.nds.tlsattacker.core.config.TLSDelegateConfig;
1415
import de.rub.nds.tlsattacker.core.config.delegate.ClientDelegate;
1516
import de.rub.nds.tlsattacker.core.config.delegate.GeneralDelegate;
@@ -28,9 +29,15 @@ public class ScannerConfig extends TLSDelegateConfig {
2829
@Parameter(names = "-threads", required = false, description = "How many threads should execute Probes")
2930
private int threads = 1;
3031

32+
@Parameter(names = "-danger", required = false, description = "Integer value (1 - 10) which specifies how aggressive the Scanner should test. Default 10")
33+
private int dangerLevel = 10;
34+
3135
@ParametersDelegate
3236
private GeneralDelegate generalDelegate;
3337

38+
@Parameter(names = "-implementation", required = false, description = "If you are interessted in the vulnerability of an implementation rather than a specific site")
39+
private boolean implementation = false;
40+
3441
public ScannerConfig(GeneralDelegate delegate) {
3542
super(delegate);
3643
this.generalDelegate = delegate;
@@ -50,4 +57,30 @@ public void setThreads(int threads) {
5057
public ClientDelegate getClientDelegate() {
5158
return clientDelegate;
5259
}
60+
61+
public int getDangerLevel() {
62+
return dangerLevel;
63+
}
64+
65+
public void setDangerLevel(int dangerLevel) {
66+
this.dangerLevel = dangerLevel;
67+
}
68+
69+
public boolean isImplementation() {
70+
return implementation;
71+
}
72+
73+
public void setImplementation(boolean implementation) {
74+
this.implementation = implementation;
75+
}
76+
77+
@Override
78+
public Config createConfig() {
79+
Config config = super.createConfig();
80+
config.setSniHostname(clientDelegate.getHost());
81+
config.getDefaultClientConnection().setTimeout(1000);
82+
return config;
83+
}
84+
85+
5386
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
package de.rub.nds.tlsscanner.constants;
7+
8+
/**
9+
*
10+
* @author Robert Merget <[email protected]>
11+
*/
12+
public class AnsiColors {
13+
14+
public static final String ANSI_RESET = "\u001B[0m";
15+
public static final String ANSI_BLACK = "\u001B[30m";
16+
public static final String ANSI_RED = "\u001B[31m";
17+
public static final String ANSI_GREEN = "\u001B[32m";
18+
public static final String ANSI_YELLOW = "\u001B[33m";
19+
public static final String ANSI_BLUE = "\u001B[34m";
20+
public static final String ANSI_PURPLE = "\u001B[35m";
21+
public static final String ANSI_CYAN = "\u001B[36m";
22+
public static final String ANSI_WHITE = "\u001B[37m";
23+
public static final String ANSI_BLACK_BACKGROUND = "\u001B[40m";
24+
public static final String ANSI_RED_BACKGROUND = "\u001B[41m";
25+
public static final String ANSI_GREEN_BACKGROUND = "\u001B[42m";
26+
public static final String ANSI_YELLOW_BACKGROUND = "\u001B[43m";
27+
public static final String ANSI_BLUE_BACKGROUND = "\u001B[44m";
28+
public static final String ANSI_PURPLE_BACKGROUND = "\u001B[45m";
29+
public static final String ANSI_CYAN_BACKGROUND = "\u001B[46m";
30+
public static final String ANSI_WHITE_BACKGROUND = "\u001B[47m";
31+
32+
private AnsiColors() {
33+
}
34+
35+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
package de.rub.nds.tlsscanner.constants;
7+
8+
/**
9+
*
10+
* @author Robert Merget <[email protected]>
11+
*/
12+
public enum CipherSuiteGrade {
13+
GOOD, LOW, MEDIUM, NONE
14+
}

0 commit comments

Comments
 (0)