|
1 | 1 | /** |
2 | 2 | * TLS-Attacker - A Modular Penetration Testing Framework for TLS. |
3 | 3 | * |
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) |
7 | 6 | * |
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 |
11 | 10 | * |
12 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | 12 | * |
14 | 13 | * 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. |
19 | 18 | */ |
20 | 19 | package de.rub.nds.tlsattacker.attacks.impl; |
21 | 20 |
|
|
30 | 29 | import de.rub.nds.tlsattacker.tls.constants.ConnectionEnd; |
31 | 30 | import de.rub.nds.tlsattacker.tls.protocol.heartbeat.HeartbeatMessage; |
32 | 31 | import de.rub.nds.tlsattacker.tls.constants.ProtocolMessageType; |
| 32 | +import de.rub.nds.tlsattacker.tls.exceptions.WorkflowExecutionException; |
33 | 33 | import de.rub.nds.tlsattacker.tls.util.LogLevel; |
34 | 34 | import de.rub.nds.tlsattacker.tls.workflow.TlsContext; |
35 | 35 | import de.rub.nds.tlsattacker.tls.workflow.WorkflowExecutor; |
@@ -70,16 +70,27 @@ public void executeAttack(ConfigHandler configHandler) { |
70 | 70 | hb.setPayload(payload); |
71 | 71 | hb.setPayloadLength(payloadLength); |
72 | 72 |
|
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 | + } |
74 | 80 |
|
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 | + } |
80 | 91 | } else { |
81 | 92 | 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."); |
83 | 94 | } |
84 | 95 |
|
85 | 96 | tlsContexts.add(tlsContext); |
|
0 commit comments