Skip to content

Commit e391c20

Browse files
Merge pull request #10 from RUB-NDS/publication
Publication
2 parents 3a9dd07 + 473da55 commit e391c20

File tree

15 files changed

+61
-205
lines changed

15 files changed

+61
-205
lines changed

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/impl/HeartbleedAttack.java

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
/**
22
* TLS-Attacker - A Modular Penetration Testing Framework for TLS.
33
*
4-
* Copyright (C) 2015 Chair for Network and Data Security,
5-
* Ruhr University Bochum
6-
* (juraj.somorovsky@rub.de)
4+
* Copyright (C) 2015 Chair for Network and Data Security, Ruhr University
5+
* Bochum (juraj.somorovsky@rub.de)
76
*
8-
* Licensed under the Apache License, Version 2.0 (the "License");
9-
* you may not use this file except in compliance with the License.
10-
* You may obtain a copy of the License at
7+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
8+
* use this file except in compliance with the License. You may obtain a copy of
9+
* the License at
1110
*
1211
* http://www.apache.org/licenses/LICENSE-2.0
1312
*
1413
* Unless required by applicable law or agreed to in writing, software
15-
* distributed under the License is distributed on an "AS IS" BASIS,
16-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17-
* See the License for the specific language governing permissions and
18-
* limitations under the License.
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations under
17+
* the License.
1918
*/
2019
package de.rub.nds.tlsattacker.attacks.impl;
2120

@@ -30,6 +29,7 @@
3029
import de.rub.nds.tlsattacker.tls.constants.ConnectionEnd;
3130
import de.rub.nds.tlsattacker.tls.protocol.heartbeat.HeartbeatMessage;
3231
import de.rub.nds.tlsattacker.tls.constants.ProtocolMessageType;
32+
import de.rub.nds.tlsattacker.tls.exceptions.WorkflowExecutionException;
3333
import de.rub.nds.tlsattacker.tls.util.LogLevel;
3434
import de.rub.nds.tlsattacker.tls.workflow.TlsContext;
3535
import de.rub.nds.tlsattacker.tls.workflow.WorkflowExecutor;
@@ -70,16 +70,27 @@ public void executeAttack(ConfigHandler configHandler) {
7070
hb.setPayload(payload);
7171
hb.setPayloadLength(payloadLength);
7272

73-
workflowExecutor.executeWorkflow();
73+
try {
74+
workflowExecutor.executeWorkflow();
75+
} catch (WorkflowExecutionException ex) {
76+
LOGGER.info(
77+
"The TLS protocol flow was not executed completely, follow the debug messages for more information.",
78+
ex);
79+
}
7480

75-
HeartbeatMessage lastMessage = (HeartbeatMessage) trace.getProtocolMessages().get(
76-
trace.getProtocolMessages().size() - 1);
77-
if (lastMessage.getMessageIssuer() == ConnectionEnd.SERVER) {
78-
LOGGER.log(LogLevel.CONSOLE_OUTPUT,
79-
"The server responds with a heartbeat message, although the client heartbeat message contains an invalid ");
81+
if (trace.containsServerFinished()) {
82+
HeartbeatMessage lastMessage = (HeartbeatMessage) trace.getProtocolMessages().get(
83+
trace.getProtocolMessages().size() - 1);
84+
if (lastMessage.getMessageIssuer() == ConnectionEnd.SERVER) {
85+
LOGGER.log(LogLevel.CONSOLE_OUTPUT,
86+
"Vulnerable. The server responds with a heartbeat message, although the client heartbeat message contains an invalid ");
87+
} else {
88+
LOGGER.log(LogLevel.CONSOLE_OUTPUT,
89+
"(Most probably) Not vulnerable. The server does not respond with a heartbeat message, it is not vulnerable");
90+
}
8091
} else {
8192
LOGGER.log(LogLevel.CONSOLE_OUTPUT,
82-
"The server does not respond with a heartbeat message, it is not vulnerable");
93+
"Correct TLS handshake cannot be executed, no Server Finished message found. Check the server configuration.");
8394
}
8495

8596
tlsContexts.add(tlsContext);

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ $ java -jar target/TLS-Attacker-1.0.jar client -help
8080

8181
The Attacks module contains some attacks, you can for example test for the padding oracle vulnerabilities:
8282
```bash
83-
$ cd Attacks/target
83+
$ cd Runnable
8484
$ java -jar target/TLS-Attacker-1.0.jar padding_oracle
8585
```
8686

@@ -314,6 +314,7 @@ We can of course use this concept by constructing our TLS workflows. Imagine you
314314
</workflowTrace>
315315
```
316316
As you can see, we explicitly increased the payload length of the Heartbeat message by 2000.
317+
If you run the attack against the vulnerable server (e.g., OpenSSL 1.0.1f), you should see a valid Heartbeat response.
317318

318319
Further examples on attacks and fuzzing are in the Wiki.
319320

Runnable/src/main/java/de/rub/nds/tlsattacker/Main.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
import de.rub.nds.tlsattacker.tls.config.GeneralConfig;
4747
import de.rub.nds.tlsattacker.tls.config.WorkflowTraceSerializer;
4848
import de.rub.nds.tlsattacker.tls.exceptions.ConfigurationException;
49+
import de.rub.nds.tlsattacker.tls.exceptions.WorkflowExecutionException;
50+
import de.rub.nds.tlsattacker.tls.util.LogLevel;
4951
import de.rub.nds.tlsattacker.tls.workflow.TlsContext;
5052
import de.rub.nds.tlsattacker.tls.workflow.WorkflowExecutor;
5153
import de.rub.nds.tlsattacker.transport.TransportHandler;
@@ -54,13 +56,17 @@
5456
import java.io.IOException;
5557
import java.util.List;
5658
import javax.xml.bind.JAXBException;
59+
import org.apache.logging.log4j.LogManager;
60+
import org.apache.logging.log4j.Logger;
5761

5862
/**
5963
*
6064
* @author Juraj Somorovsky <juraj.somorovsky@rub.de>
6165
*/
6266
public class Main {
6367

68+
private static final Logger LOGGER = LogManager.getLogger(Main.class);
69+
6470
public static void main(String[] args) throws Exception {
6571

6672
GeneralConfig generalConfig = new GeneralConfig();
@@ -172,7 +178,13 @@ private static void startSimpleTls(GeneralConfig generalConfig, CommandConfig co
172178
TlsContext tlsContext = configHandler.initializeTlsContext(config);
173179
WorkflowExecutor workflowExecutor = configHandler.initializeWorkflowExecutor(transportHandler, tlsContext);
174180

175-
workflowExecutor.executeWorkflow();
181+
try {
182+
workflowExecutor.executeWorkflow();
183+
} catch (WorkflowExecutionException ex) {
184+
LOGGER.info(ex.getLocalizedMessage(), ex);
185+
LOGGER.log(LogLevel.CONSOLE_OUTPUT,
186+
"The TLS protocol flow was not executed completely, follow the debug messages for more information.");
187+
}
176188

177189
transportHandler.closeConnection();
178190

resources/README

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
RSA key pair generation (password is password):
1+
Java keystores have the password password and the alias alias, see e.g.:
2+
```bash
3+
$ keytool -list -keystore rsa1024.jks
4+
```
5+
6+
Pem keys are without password:
7+
```bash
8+
$ openssl rsa -in rsa1024key.pem -text
9+
$ openssl x509 -in rsa1024cert.pem -text
10+
```
11+
12+
13+
The following commands were used for RSA key pair generation (password is password):
214

315
- Generate JKS:
416
keytool -keystore rsa1024.jks -genkeypair -alias alias -validity 3650 -keysize 1024 -keyalg rsa
@@ -20,7 +32,7 @@ openssl rsa -in rsa1024key.pem -out rsa1024key.pem
2032

2133

2234

23-
EC key pair generation (password is password):
35+
The following commands were used for RSA key pair generation EC key pair generation (password is password):
2436

2537
- Generate JKS:
2638
keytool -keystore ec256.jks -genkeypair -alias alias -validity 3650 -keysize 256 -keyalg ec
@@ -38,4 +50,7 @@ openssl pkcs12 -in ec256.p12 -out ec256cert.pem -nokeys
3850
openssl pkcs12 -in ec256.p12 -out ec256key.pem -nocerts
3951

4052
- Remove password from the key file:
41-
openssl ec -in ec256key.pem -out ec256key.pem
53+
openssl ec -in ec256key.pem -out ec256key.pem
54+
55+
56+
For more information on the different formats, see: http://web-in-security.blogspot.de/2015/11/playing-with-certificates-from.html

resources/command-gnutls

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/command-java

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/command-openssl

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/command-polarssl

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/config-multifuzzer-boringssl

Lines changed: 0 additions & 27 deletions
This file was deleted.

resources/config-multifuzzer-botan

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)