forked from tls-attacker/TLS-Attacker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
569 changed files
with
15,502 additions
and
5,030 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<workflowTrace> | ||
<Send> | ||
<messages> | ||
<ClientHello> | ||
<extensions> | ||
<ECPointFormat/> | ||
<EllipticCurves/> | ||
<RenegotiationInfoExtension/> | ||
</extensions> | ||
</ClientHello> | ||
</messages> | ||
</Send> | ||
<Receive> | ||
<expectedMessages> | ||
<ServerHello> | ||
<extensions> | ||
<ECPointFormat/> | ||
<RenegotiationInfoExtension/> | ||
</extensions> | ||
</ServerHello> | ||
<Certificate/> | ||
<ServerHelloDone/> | ||
</expectedMessages> | ||
</Receive> | ||
<Send> | ||
<messages> | ||
<RSAClientKeyExchange/> | ||
<ChangeCipherSpec/> | ||
</messages> | ||
</Send> | ||
<Receive> | ||
<expectedMessages> | ||
<ChangeCipherSpec/> | ||
<Finished/> | ||
</expectedMessages> | ||
</Receive> | ||
</workflowTrace> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/actions/EarlyCcsAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* TLS-Attacker - A Modular Penetration Testing Framework for TLS | ||
* | ||
* Copyright 2014-2017 Ruhr University Bochum / Hackmanit GmbH | ||
* | ||
* Licensed under Apache License 2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package de.rub.nds.tlsattacker.attacks.actions; | ||
|
||
import de.rub.nds.modifiablevariable.bool.BooleanExplicitValueModification; | ||
import de.rub.nds.modifiablevariable.bool.ModifiableBoolean; | ||
import de.rub.nds.tlsattacker.core.constants.AlgorithmResolver; | ||
import de.rub.nds.tlsattacker.core.constants.ProtocolMessageType; | ||
import de.rub.nds.tlsattacker.core.exceptions.WorkflowExecutionException; | ||
import de.rub.nds.tlsattacker.core.protocol.handler.ClientKeyExchangeHandler; | ||
import de.rub.nds.tlsattacker.core.protocol.message.ClientKeyExchangeMessage; | ||
import de.rub.nds.tlsattacker.core.record.AbstractRecord; | ||
import de.rub.nds.tlsattacker.core.record.Record; | ||
import de.rub.nds.tlsattacker.core.state.State; | ||
import de.rub.nds.tlsattacker.core.workflow.action.TlsAction; | ||
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowConfigurationFactory; | ||
import java.io.IOException; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
/** | ||
* | ||
* @author robert | ||
*/ | ||
public class EarlyCcsAction extends TlsAction { | ||
|
||
private Boolean targetOpenssl1_0_0; | ||
|
||
public EarlyCcsAction(Boolean adjustContext) { | ||
this.targetOpenssl1_0_0 = adjustContext; | ||
} | ||
|
||
@Override | ||
public void execute(State state) throws WorkflowExecutionException, IOException { | ||
Record r = new Record(); | ||
WorkflowConfigurationFactory factory = new WorkflowConfigurationFactory(state.getConfig()); | ||
ClientKeyExchangeMessage message = factory.createClientKeyExchangeMessage(AlgorithmResolver | ||
.getKeyExchangeAlgorithm(state.getTlsContext().getSelectedCipherSuite())); | ||
ModifiableBoolean modifiableBoolean = new ModifiableBoolean(); | ||
modifiableBoolean.setModification(new BooleanExplicitValueModification(false)); | ||
if (!targetOpenssl1_0_0) { | ||
message.setIncludeInDigest(modifiableBoolean); | ||
} | ||
message.setAdjustContext(modifiableBoolean); | ||
ClientKeyExchangeHandler handler = (ClientKeyExchangeHandler) message.getHandler(state.getTlsContext()); | ||
byte[] protocolMessageBytes = handler.prepareMessage(message); | ||
if (targetOpenssl1_0_0) { | ||
handler.adjustPremasterSecret(message); | ||
handler.adjustMasterSecret(message); | ||
} | ||
handler.adjustTlsContextAfterSerialize(message); | ||
List<AbstractRecord> recordList = new LinkedList<>(); | ||
recordList.add(new Record()); | ||
byte[] prepareRecords = state.getTlsContext().getRecordLayer() | ||
.prepareRecords(protocolMessageBytes, ProtocolMessageType.HANDSHAKE, recordList); | ||
state.getTlsContext().getTransportHandler().sendData(prepareRecords); | ||
setExecuted(true); | ||
} | ||
|
||
@Override | ||
public void reset() { | ||
// nothing to do; | ||
} | ||
|
||
@Override | ||
public boolean executedAsPlanned() { | ||
return isExecuted(); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/GuessProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* TLS-Attacker - A Modular Penetration Testing Framework for TLS | ||
* | ||
* Copyright 2014-2017 Ruhr University Bochum / Hackmanit GmbH | ||
* | ||
* Licensed under Apache License 2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package de.rub.nds.tlsattacker.attacks.bruteforce; | ||
|
||
public abstract class GuessProvider { | ||
|
||
private final GuessProviderType type; | ||
|
||
public GuessProvider(GuessProviderType type) { | ||
this.type = type; | ||
} | ||
|
||
public abstract byte[] getGuess(); | ||
|
||
public GuessProviderType getType() { | ||
return type; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/GuessProviderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* TLS-Attacker - A Modular Penetration Testing Framework for TLS | ||
* | ||
* Copyright 2014-2017 Ruhr University Bochum / Hackmanit GmbH | ||
* | ||
* Licensed under Apache License 2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package de.rub.nds.tlsattacker.attacks.bruteforce; | ||
|
||
import java.io.InputStream; | ||
|
||
public class GuessProviderFactory { | ||
|
||
public static GuessProvider createGuessProvider(GuessProviderType type, InputStream guessSource) { | ||
switch (type) { | ||
case INCREMENTING: | ||
return new IncrementingGuessProvider(); | ||
case WORDLIST: | ||
return new WordListGuessProvider(guessSource); | ||
default: | ||
throw new UnsupportedOperationException("Guess provider \"" + type + "\" is not supported"); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/GuessProviderType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* TLS-Attacker - A Modular Penetration Testing Framework for TLS | ||
* | ||
* Copyright 2014-2017 Ruhr University Bochum / Hackmanit GmbH | ||
* | ||
* Licensed under Apache License 2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package de.rub.nds.tlsattacker.attacks.bruteforce; | ||
|
||
public enum GuessProviderType { | ||
INCREMENTING, | ||
WORDLIST | ||
} |
51 changes: 51 additions & 0 deletions
51
...ks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/IncrementingGuessProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* TLS-Attacker - A Modular Penetration Testing Framework for TLS | ||
* | ||
* Copyright 2014-2017 Ruhr University Bochum / Hackmanit GmbH | ||
* | ||
* Licensed under Apache License 2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package de.rub.nds.tlsattacker.attacks.bruteforce; | ||
|
||
public class IncrementingGuessProvider extends GuessProvider { | ||
|
||
private byte[] lastGuess = null; | ||
|
||
private int size = 0; | ||
|
||
public IncrementingGuessProvider() { | ||
super(GuessProviderType.INCREMENTING); | ||
} | ||
|
||
@Override | ||
public byte[] getGuess() { | ||
byte[] guess = getIncrementedGuess(); | ||
return guess; | ||
} | ||
|
||
public byte[] getIncrementedGuess() { | ||
if (lastGuess == null) { | ||
lastGuess = new byte[size]; | ||
} else { | ||
lastGuess = createdIncrementedAtPosition(lastGuess, 0); | ||
if (lastGuess == null) { | ||
size++; | ||
lastGuess = new byte[size]; | ||
} | ||
} | ||
return lastGuess; | ||
} | ||
|
||
public byte[] createdIncrementedAtPosition(byte[] array, int position) { | ||
if (array.length > position) { | ||
array[position] = (byte) (array[position] + 1); | ||
if (array[position] == 0) { | ||
return createdIncrementedAtPosition(array, position + 1); | ||
} | ||
return array; | ||
} else { | ||
return null; | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/WordListGuessProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* TLS-Attacker - A Modular Penetration Testing Framework for TLS | ||
* | ||
* Copyright 2014-2017 Ruhr University Bochum / Hackmanit GmbH | ||
* | ||
* Licensed under Apache License 2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package de.rub.nds.tlsattacker.attacks.bruteforce; | ||
|
||
import de.rub.nds.modifiablevariable.util.ArrayConverter; | ||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
|
||
public class WordListGuessProvider extends GuessProvider { | ||
|
||
private final BufferedReader bufferedReader; | ||
|
||
public WordListGuessProvider(InputStream stream) { | ||
super(GuessProviderType.WORDLIST); | ||
bufferedReader = new BufferedReader(new InputStreamReader(stream)); | ||
} | ||
|
||
@Override | ||
public byte[] getGuess() { | ||
try { | ||
String line = bufferedReader.readLine(); | ||
if (line == null) { | ||
return null; | ||
} | ||
return ArrayConverter.hexStringToByteArray(line); | ||
} catch (IOException ex) { | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.