Skip to content

Commit d9f977c

Browse files
authored
Merge branch 'master' into fuzzing_cert
2 parents 204e65b + dc342b0 commit d9f977c

File tree

158 files changed

+2207
-1877
lines changed

Some content is hidden

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

158 files changed

+2207
-1877
lines changed

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/Main.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import de.rub.nds.tlsattacker.attacks.config.PskBruteForcerAttackServerCommandConfig;
2222
import de.rub.nds.tlsattacker.attacks.config.SimpleMitmProxyCommandConfig;
2323
import de.rub.nds.tlsattacker.attacks.config.TLSPoodleCommandConfig;
24-
import de.rub.nds.tlsattacker.attacks.config.TooManyAlgorithmsAttackConfig;
25-
import de.rub.nds.tlsattacker.attacks.config.WinshockCommandConfig;
2624
import de.rub.nds.tlsattacker.attacks.config.delegate.GeneralAttackDelegate;
2725
import de.rub.nds.tlsattacker.attacks.impl.Attacker;
2826
import de.rub.nds.tlsattacker.attacks.impl.BleichenbacherAttacker;
@@ -37,19 +35,24 @@
3735
import de.rub.nds.tlsattacker.attacks.impl.PskBruteForcerAttackServer;
3836
import de.rub.nds.tlsattacker.attacks.impl.SimpleMitmProxy;
3937
import de.rub.nds.tlsattacker.attacks.impl.TLSPoodleAttacker;
40-
import de.rub.nds.tlsattacker.attacks.impl.TooManyAlgorithmsAttacker;
41-
import de.rub.nds.tlsattacker.attacks.impl.WinshockAttacker;
4238
import de.rub.nds.tlsattacker.core.config.TLSDelegateConfig;
4339
import de.rub.nds.tlsattacker.core.config.delegate.GeneralDelegate;
4440
import de.rub.nds.tlsattacker.core.exceptions.ConfigurationException;
4541
import static de.rub.nds.tlsattacker.util.ConsoleLogger.CONSOLE;
4642
import org.apache.logging.log4j.LogManager;
4743
import org.apache.logging.log4j.Logger;
4844

45+
/**
46+
*
47+
*/
4948
public class Main {
5049

5150
private static final Logger LOGGER = LogManager.getLogger();
5251

52+
/**
53+
*
54+
* @param args
55+
*/
5356
public static void main(String[] args) {
5457
GeneralDelegate generalDelegate = new GeneralAttackDelegate();
5558
JCommander jc = new JCommander(generalDelegate);
@@ -73,16 +76,12 @@ public static void main(String[] args) {
7376
jc.addCommand(TLSPoodleCommandConfig.ATTACK_COMMAND, tlsPoodle);
7477
Cve20162107CommandConfig cve20162107 = new Cve20162107CommandConfig(generalDelegate);
7578
jc.addCommand(Cve20162107CommandConfig.ATTACK_COMMAND, cve20162107);
76-
WinshockCommandConfig winshock = new WinshockCommandConfig(generalDelegate);
77-
jc.addCommand(WinshockCommandConfig.ATTACK_COMMAND, winshock);
7879
EarlyCCSCommandConfig earlyCCS = new EarlyCCSCommandConfig(generalDelegate);
7980
jc.addCommand(EarlyCCSCommandConfig.ATTACK_COMMAND, earlyCCS);
8081
PoodleCommandConfig poodle = new PoodleCommandConfig(generalDelegate);
8182
jc.addCommand(PoodleCommandConfig.ATTACK_COMMAND, poodle);
8283
SimpleMitmProxyCommandConfig simpleMitmProxy = new SimpleMitmProxyCommandConfig(generalDelegate);
8384
jc.addCommand(SimpleMitmProxyCommandConfig.ATTACK_COMMAND, simpleMitmProxy);
84-
TooManyAlgorithmsAttackConfig tooManyAlgorithms = new TooManyAlgorithmsAttackConfig(generalDelegate);
85-
jc.addCommand(TooManyAlgorithmsAttackConfig.ATTACK_COMMAND, tooManyAlgorithms);
8685
DrownCommandConfig drownConfig = new DrownCommandConfig(generalDelegate);
8786
jc.addCommand(DrownCommandConfig.COMMAND, drownConfig);
8887
jc.parse(args);
@@ -114,12 +113,6 @@ public static void main(String[] args) {
114113
case Cve20162107CommandConfig.ATTACK_COMMAND:
115114
attacker = new Cve20162107Attacker(cve20162107, cve20162107.createConfig());
116115
break;
117-
case WinshockCommandConfig.ATTACK_COMMAND:
118-
attacker = new WinshockAttacker(winshock, winshock.createConfig());
119-
break;
120-
case TooManyAlgorithmsAttackConfig.ATTACK_COMMAND:
121-
attacker = new TooManyAlgorithmsAttacker(tooManyAlgorithms, tooManyAlgorithms.createConfig());
122-
break;
123116
case EarlyCCSCommandConfig.ATTACK_COMMAND:
124117
attacker = new EarlyCCSAttacker(earlyCCS, earlyCCS.createConfig());
125118
break;
@@ -169,6 +162,12 @@ public static void main(String[] args) {
169162
}
170163
}
171164

165+
/**
166+
*
167+
* @param jc
168+
* @param config
169+
* @return
170+
*/
172171
public static boolean isPrintHelpForCommand(JCommander jc, TLSDelegateConfig config) {
173172
return config.getGeneralDelegate().isHelp();
174173
}

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/actions/EarlyCcsAction.java

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import de.rub.nds.modifiablevariable.bool.ModifiableBoolean;
1313
import de.rub.nds.tlsattacker.core.constants.AlgorithmResolver;
1414
import de.rub.nds.tlsattacker.core.constants.ProtocolMessageType;
15-
import de.rub.nds.tlsattacker.core.exceptions.WorkflowExecutionException;
1615
import de.rub.nds.tlsattacker.core.protocol.handler.ClientKeyExchangeHandler;
1716
import de.rub.nds.tlsattacker.core.protocol.message.ClientKeyExchangeMessage;
1817
import de.rub.nds.tlsattacker.core.record.AbstractRecord;
@@ -25,20 +24,38 @@
2524
import java.util.List;
2625

2726
/**
27+
* This Action is used by the EarlyCcs Attack. It sends a ClientKeyExchange
28+
* message and adjusts the cryptographic material accordingly.
2829
*
29-
* @author robert
3030
*/
3131
public class EarlyCcsAction extends TlsAction {
3232

3333
private final Boolean targetOpenssl1_0_0;
3434

35-
public EarlyCcsAction(Boolean adjustContext) {
36-
this.targetOpenssl1_0_0 = adjustContext;
35+
/**
36+
* Constructor for the Action. If the target is Openssl 1.0.0 the boolean
37+
* value should be set to true
38+
*
39+
* @param targetsOpenssl1_0_0
40+
* If the target is an openssl 1.0.0 server
41+
*/
42+
public EarlyCcsAction(Boolean targetsOpenssl1_0_0) {
43+
this.targetOpenssl1_0_0 = targetsOpenssl1_0_0;
3744
}
3845

46+
/**
47+
* Sends a ClientKeyExchange message depending on the currently selected
48+
* ciphersuite. Depening on the target version cryptographic material is
49+
* adjusted.
50+
*
51+
* @param state
52+
* the State in which the action should be executed in
53+
* @throws IOException
54+
* If something goes wrong during the transmission of the
55+
* ClientKeyExchange message
56+
*/
3957
@Override
40-
public void execute(State state) throws WorkflowExecutionException, IOException {
41-
Record r = new Record();
58+
public void execute(State state) throws IOException {
4259
WorkflowConfigurationFactory factory = new WorkflowConfigurationFactory(state.getConfig());
4360
ClientKeyExchangeMessage message = factory.createClientKeyExchangeMessage(AlgorithmResolver
4461
.getKeyExchangeAlgorithm(state.getTlsContext().getChooser().getSelectedCipherSuite()));
@@ -63,9 +80,12 @@ public void execute(State state) throws WorkflowExecutionException, IOException
6380
setExecuted(true);
6481
}
6582

83+
/**
84+
* Rests the executed state of the action
85+
*/
6686
@Override
6787
public void reset() {
68-
// nothing to do;
88+
setExecuted(false);
6989
}
7090

7191
@Override

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/GuessProvider.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,39 @@
88
*/
99
package de.rub.nds.tlsattacker.attacks.bruteforce;
1010

11+
/**
12+
* A GuessProvider is responsible for the creation of byte[] sequences for brute
13+
* force attacks. The guess provider should minimize the number of guesses
14+
* according to heuristics.
15+
*/
1116
public abstract class GuessProvider {
1217

1318
private final GuessProviderType type;
1419

20+
/**
21+
* Constructor
22+
*
23+
* @param type
24+
* Type of the GuessProvider
25+
*/
1526
public GuessProvider(GuessProviderType type) {
1627
this.type = type;
1728
}
1829

30+
/**
31+
* Returns the next guess for the attack. Guesses should not repeat, but it
32+
* is not completly prohibited by this API. Returns null if no more guesses
33+
* are available.
34+
*
35+
* @return The next byte[] to be used in the brute force attack.
36+
*/
1937
public abstract byte[] getGuess();
2038

39+
/**
40+
* Retunrs the type of this GuessProvider
41+
*
42+
* @return Type of this GuessProvider
43+
*/
2144
public GuessProviderType getType() {
2245
return type;
2346
}

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/GuessProviderFactory.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,25 @@
1010

1111
import java.io.InputStream;
1212

13+
/**
14+
* A Factory class for GuessProvider instances, which creates GuessProvider
15+
* objects based on a GuessProviderType.
16+
*/
1317
public class GuessProviderFactory {
1418

19+
/**
20+
* Creates GuessProvider objects based on a GuessProviderType. Some
21+
* GuessProvider require an InputSource to create their guesses. If the
22+
* GuessProvider does not use an InputStream, the InputStream is ignored
23+
*
24+
* @param type
25+
* Type of the GuessProvider which should be created
26+
* @param guessSource
27+
* An InputStream as an input source for the GuessProvider. If
28+
* the GuessProvider does not use an InputStream the guessSource
29+
* is ignored.
30+
* @return A new GuessProvider object.
31+
*/
1532
public static GuessProvider createGuessProvider(GuessProviderType type, InputStream guessSource) {
1633
switch (type) {
1734
case INCREMENTING:

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/GuessProviderType.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,18 @@
88
*/
99
package de.rub.nds.tlsattacker.attacks.bruteforce;
1010

11+
/**
12+
* A Type of GuessProvider.
13+
*/
1114
public enum GuessProviderType {
15+
16+
/**
17+
* An IncrementingGuessProvider just tries all byte[] sequences in order
18+
*/
1219
INCREMENTING,
20+
/**
21+
* A WordListGuessProvider uses an InputSource to try all words from the
22+
* InputSource
23+
*/
1324
WORDLIST
1425
}

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/IncrementingGuessProvider.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,37 @@
88
*/
99
package de.rub.nds.tlsattacker.attacks.bruteforce;
1010

11+
/**
12+
* An IncrementingGuessProvider is a GuessProvider which tries all byte[]
13+
* sequences in a growing order. Starting by an empty byte[] and then continuing
14+
* the sequence with th byte[] size increased by 1. It would then try 00, 01,
15+
* 02, ..., FF and continue with 00 00, 00 01, 00 02 , ... to FF, FF and so on.
16+
*/
1117
public class IncrementingGuessProvider extends GuessProvider {
1218

1319
private byte[] lastGuess = null;
1420

1521
private int size = 0;
1622

23+
/**
24+
* Default Constructor
25+
*/
1726
public IncrementingGuessProvider() {
1827
super(GuessProviderType.INCREMENTING);
1928
}
2029

30+
/**
31+
* Returns the last Guess incremented by 1.
32+
*
33+
* @return
34+
*/
2135
@Override
2236
public byte[] getGuess() {
2337
byte[] guess = getIncrementedGuess();
2438
return guess;
2539
}
2640

27-
public byte[] getIncrementedGuess() {
41+
private byte[] getIncrementedGuess() {
2842
if (lastGuess == null) {
2943
lastGuess = new byte[size];
3044
} else {
@@ -37,7 +51,7 @@ public byte[] getIncrementedGuess() {
3751
return lastGuess;
3852
}
3953

40-
public byte[] createdIncrementedAtPosition(byte[] array, int position) {
54+
private byte[] createdIncrementedAtPosition(byte[] array, int position) {
4155
if (array.length > position) {
4256
array[position] = (byte) (array[position] + 1);
4357
if (array[position] == 0) {

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/bruteforce/WordListGuessProvider.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,33 @@
1414
import java.io.InputStream;
1515
import java.io.InputStreamReader;
1616

17+
/**
18+
* A GuessProvider based on a WordList. It reads bytes from the inpustream until
19+
* a newline character is found. If the InputStream does not contain anymore
20+
* lines. Null is returned.
21+
*/
1722
public class WordListGuessProvider extends GuessProvider {
1823

1924
private final BufferedReader bufferedReader;
2025

26+
/**
27+
* Constructor
28+
*
29+
* @param stream
30+
* An Inputstream to read Guesses from
31+
*/
2132
public WordListGuessProvider(InputStream stream) {
2233
super(GuessProviderType.WORDLIST);
2334
bufferedReader = new BufferedReader(new InputStreamReader(stream));
2435
}
2536

37+
/**
38+
* Returns the next word from the inputstream. If no more words are in the
39+
* in InputStream null is returned.
40+
*
41+
* @return The next word from the inputstream. If no more words are in the
42+
* in InputStream null is returned.
43+
*/
2644
@Override
2745
public byte[] getGuess() {
2846
try {

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/config/AttackConfig.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,40 @@
1212
import de.rub.nds.tlsattacker.core.config.TLSDelegateConfig;
1313
import de.rub.nds.tlsattacker.core.config.delegate.GeneralDelegate;
1414

15+
/**
16+
*
17+
*/
1518
public abstract class AttackConfig extends TLSDelegateConfig {
1619

1720
@Parameter(names = "-skipConnectionCheck", description = "If set to true the Attacker will not check if the target is reachable.")
1821
private boolean skipConnectionCheck = false;
1922

23+
/**
24+
*
25+
* @param delegate
26+
*/
2027
public AttackConfig(GeneralDelegate delegate) {
2128
super(delegate);
2229
}
2330

31+
/**
32+
*
33+
* @return
34+
*/
2435
public abstract boolean isExecuteAttack();
2536

37+
/**
38+
*
39+
* @return
40+
*/
2641
public boolean isSkipConnectionCheck() {
2742
return skipConnectionCheck;
2843
}
2944

45+
/**
46+
*
47+
* @param skipConnectionCheck
48+
*/
3049
public void setSkipConnectionCheck(boolean skipConnectionCheck) {
3150
this.skipConnectionCheck = skipConnectionCheck;
3251
}

0 commit comments

Comments
 (0)