Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
import de.rub.nds.tlsattacker.core.constants.CipherSuite;
import de.rub.nds.tlsattacker.core.constants.ProtocolVersion;
import de.rub.nds.tlsattacker.core.constants.RunningModeType;
import de.rub.nds.tlsattacker.core.protocol.message.AckMessage;
import de.rub.nds.tlsattacker.core.protocol.message.FinishedMessage;
import de.rub.nds.tlsattacker.core.state.State;
import de.rub.nds.tlsattacker.core.workflow.ParallelExecutor;
import de.rub.nds.tlsattacker.core.workflow.WorkflowTrace;
import de.rub.nds.tlsattacker.core.workflow.action.ReceiveTillAction;
import de.rub.nds.tlsattacker.core.workflow.action.SendAction;
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowConfigurationFactory;
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowTraceType;
import de.rub.nds.tlsscanner.clientscanner.config.ClientScannerConfig;
Expand Down Expand Up @@ -54,7 +56,7 @@ protected void executeTest() {

while (!toTestList.isEmpty()) {
Config config;
if (version.isTLS13()) {
if (version.is13()) {
config = getTls13Config();
} else {
config = getBaseConfig();
Expand All @@ -70,6 +72,9 @@ protected void executeTest() {
.createWorkflowTrace(
WorkflowTraceType.HELLO, RunningModeType.SERVER);
trace.addTlsAction(new ReceiveTillAction(new FinishedMessage()));
if (config.getHighestProtocolVersion().isDTLS13()) {
trace.addTlsAction(new SendAction(new AckMessage()));
}

State state = new State(config, trace);
statesToExecute.add(state);
Expand Down Expand Up @@ -109,7 +114,9 @@ private Config getBaseConfig() {

private Config getTls13Config() {
Config config = getBaseConfig();
config.setHighestProtocolVersion(ProtocolVersion.TLS13);
config.setSupportedVersions(ProtocolVersion.TLS13);
scannerConfig.getDtlsDelegate().applyDelegate(config);
config.setAddECPointFormatExtension(false);
config.setAddEllipticCurveExtension(true);
config.setAddSignatureAndHashAlgorithmsExtension(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import de.rub.nds.tlsattacker.core.constants.KeyExchangeAlgorithm;
import de.rub.nds.tlsattacker.core.constants.NamedGroup;
import de.rub.nds.tlsattacker.core.constants.ProtocolVersion;
import de.rub.nds.tlsattacker.core.protocol.message.AckMessage;
import de.rub.nds.tlsattacker.core.protocol.message.ClientHelloMessage;
import de.rub.nds.tlsattacker.core.protocol.message.FinishedMessage;
import de.rub.nds.tlsattacker.core.protocol.message.HandshakeMessage;
Expand All @@ -31,6 +32,8 @@
import de.rub.nds.tlsattacker.core.workflow.WorkflowTraceConfigurationUtil;
import de.rub.nds.tlsattacker.core.workflow.WorkflowTraceResultUtil;
import de.rub.nds.tlsattacker.core.workflow.action.ReceiveAction;
import de.rub.nds.tlsattacker.core.workflow.action.SendAction;
import de.rub.nds.tlsattacker.core.workflow.action.executor.ActionOption;
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowConfigurationFactory;
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowTraceType;
import de.rub.nds.tlsscanner.clientscanner.config.ClientScannerConfig;
Expand All @@ -48,6 +51,7 @@ public class NamedGroupsProbe extends TlsClientProbe {
private final List<NamedGroup> ffdheToTest = new LinkedList<>();

private final List<NamedGroup> advertisedKeyShareGroups = new LinkedList<>();
private List<NamedGroup> advertisedNamedGroups;
private List<CipherSuite> supportedDheCipherSuites;
private List<CipherSuite> supportedEcdheCipherSuites;
private List<CipherSuite> supportedTls13CipherSuites;
Expand Down Expand Up @@ -93,6 +97,7 @@ private List<NamedGroup> getCurvesToTest() {
private List<NamedGroup> getTls13GroupsToTest() {
List<NamedGroup> groupList = getCurvesToTest();
NamedGroup.getImplemented().stream().filter(NamedGroup::isDhGroup).forEach(groupList::add);
groupList.retainAll(advertisedNamedGroups);
return groupList;
}

Expand Down Expand Up @@ -125,14 +130,23 @@ private List<NamedGroup> getSupportedGroupsTls13(
setSharedConfigFields(config, group, cipherSuites);
config.setHighestProtocolVersion(ProtocolVersion.TLS13);
config.setDefaultSelectedProtocolVersion(ProtocolVersion.TLS13);
config.setSupportedVersions(ProtocolVersion.TLS13);
scannerConfig.getDtlsDelegate().applyDelegate(config);
config.setAddKeyShareExtension(true);
config.setAddSupportedVersionsExtension(true);
WorkflowTrace workflowTrace;
if (advertisedKeyShareGroups.contains(group)) {
workflowTrace =
new WorkflowConfigurationFactory(config)
.createDynamicHelloWorkflow(config.getDefaultServerConnection());
workflowTrace.addTlsAction(new ReceiveAction(new FinishedMessage()));
ReceiveAction receiveFinished = new ReceiveAction(new FinishedMessage());
if (config.getHighestProtocolVersion().isDTLS13()) {
receiveFinished.addActionOption(ActionOption.IGNORE_ACK_MESSAGES);
}
workflowTrace.addTlsAction(receiveFinished);
if (config.getHighestProtocolVersion().isDTLS13()) {
workflowTrace.addTlsAction(new SendAction(new AckMessage()));
}
} else {
workflowTrace =
new WorkflowConfigurationFactory(config)
Expand Down Expand Up @@ -191,6 +205,7 @@ public void setSharedConfigFields(

@Override
public void adjustConfig(ClientReport report) {
advertisedNamedGroups = report.getClientAdvertisedNamedGroupsList();
report.getClientAdvertisedNamedGroupsList().stream()
.filter(NamedGroup::isDhGroup)
.forEach(ffdheToTest::add);
Expand Down Expand Up @@ -219,6 +234,8 @@ public Requirement<ClientReport> getRequirements() {
new PropertyTrueRequirement<>(
TlsAnalyzedProperty.SUPPORTS_ECDHE),
new PropertyTrueRequirement<>(
TlsAnalyzedProperty.SUPPORTS_TLS_1_3))));
TlsAnalyzedProperty.SUPPORTS_TLS_1_3),
new PropertyTrueRequirement<>(
TlsAnalyzedProperty.SUPPORTS_DTLS_1_3))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import de.rub.nds.tlsattacker.core.constants.CompressionMethod;
import de.rub.nds.tlsattacker.core.constants.ProtocolVersion;
import de.rub.nds.tlsattacker.core.constants.RunningModeType;
import de.rub.nds.tlsattacker.core.protocol.message.AckMessage;
import de.rub.nds.tlsattacker.core.protocol.message.FinishedMessage;
import de.rub.nds.tlsattacker.core.state.State;
import de.rub.nds.tlsattacker.core.workflow.ParallelExecutor;
import de.rub.nds.tlsattacker.core.workflow.WorkflowTrace;
import de.rub.nds.tlsattacker.core.workflow.action.ReceiveTillAction;
import de.rub.nds.tlsattacker.core.workflow.action.SendAction;
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowConfigurationFactory;
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowTraceType;
import de.rub.nds.tlsscanner.clientscanner.config.ClientScannerConfig;
Expand All @@ -45,6 +47,7 @@ public ProtocolVersionProbe(ParallelExecutor executor, ClientScannerConfig scann
TlsAnalyzedProperty.SUPPORTS_DTLS_1_0_DRAFT,
TlsAnalyzedProperty.SUPPORTS_DTLS_1_0,
TlsAnalyzedProperty.SUPPORTS_DTLS_1_2,
TlsAnalyzedProperty.SUPPORTS_DTLS_1_3,
TlsAnalyzedProperty.SUPPORTS_SSL_2,
TlsAnalyzedProperty.SUPPORTS_SSL_3,
TlsAnalyzedProperty.SUPPORTS_TLS_1_0,
Expand All @@ -63,7 +66,7 @@ protected void executeTest() {
LOGGER.debug("Testing version {}", version);

Config config;
if (version.isTLS13()) {
if (version.is13()) {
config = getTls13Config();
} else {
config = getBaseConfig();
Expand Down Expand Up @@ -94,7 +97,11 @@ protected void executeTest() {
private List<CipherSuite> getSuitableCipherSuites(ProtocolVersion version) {
List<CipherSuite> suitableCiphersuites =
clientAdvertisedCipherSuites.stream()
.filter(suite -> suite.isSupportedInProtocol(version))
.filter(
suite ->
version.is13()
? suite.isTls13()
: suite.isSupportedInProtocol(version))
.collect(Collectors.toList());
if (suitableCiphersuites.isEmpty()) {
CipherSuite fallbackCipherSuite;
Expand Down Expand Up @@ -122,6 +129,9 @@ private State getStateForTest(Config config, List<CipherSuite> suitableCiphersui
new WorkflowConfigurationFactory(config)
.createWorkflowTrace(WorkflowTraceType.HELLO, RunningModeType.SERVER);
trace.addTlsAction(new ReceiveTillAction(new FinishedMessage()));
if (config.getHighestProtocolVersion().isDTLS13()) {
trace.addTlsAction(new SendAction(new AckMessage()));
}

return new State(config, trace);
}
Expand All @@ -135,6 +145,8 @@ private Config getBaseConfig() {

private Config getTls13Config() {
Config config = getBaseConfig();
config.setHighestProtocolVersion(ProtocolVersion.TLS13);
scannerConfig.getDtlsDelegate().applyDelegate(config);
config.setAddRenegotiationInfoExtension(false);
config.setAddECPointFormatExtension(false);
config.setAddEllipticCurveExtension(true);
Expand Down Expand Up @@ -163,6 +175,9 @@ protected void mergeData(ClientReport report) {
if (version == ProtocolVersion.DTLS12) {
put(TlsAnalyzedProperty.SUPPORTS_DTLS_1_2, TestResults.TRUE);
}
if (version == ProtocolVersion.DTLS13) {
put(TlsAnalyzedProperty.SUPPORTS_DTLS_1_3, TestResults.TRUE);
}
if (version == ProtocolVersion.SSL2) {
put(TlsAnalyzedProperty.SUPPORTS_SSL_2, TestResults.TRUE);
}
Expand Down Expand Up @@ -193,6 +208,9 @@ protected void mergeData(ClientReport report) {
if (version == ProtocolVersion.DTLS12) {
put(TlsAnalyzedProperty.SUPPORTS_DTLS_1_2, TestResults.FALSE);
}
if (version == ProtocolVersion.DTLS13) {
put(TlsAnalyzedProperty.SUPPORTS_DTLS_1_3, TestResults.FALSE);
}
if (version == ProtocolVersion.SSL2) {
put(TlsAnalyzedProperty.SUPPORTS_SSL_2, TestResults.FALSE);
}
Expand Down Expand Up @@ -221,6 +239,9 @@ protected void mergeData(ClientReport report) {
if (!toTestList.contains(ProtocolVersion.DTLS12)) {
put(TlsAnalyzedProperty.SUPPORTS_DTLS_1_2, TestResults.COULD_NOT_TEST);
}
if (!toTestList.contains(ProtocolVersion.DTLS13)) {
put(TlsAnalyzedProperty.SUPPORTS_DTLS_1_3, TestResults.COULD_NOT_TEST);
}

if (!toTestList.contains(ProtocolVersion.SSL2)) {
put(TlsAnalyzedProperty.SUPPORTS_SSL_2, TestResults.COULD_NOT_TEST);
Expand Down Expand Up @@ -254,6 +275,7 @@ public void adjustConfig(ClientReport report) {
toTestList.add(ProtocolVersion.DTLS10_DRAFT);
toTestList.add(ProtocolVersion.DTLS10);
toTestList.add(ProtocolVersion.DTLS12);
toTestList.add(ProtocolVersion.DTLS13);
} else {
toTestList.add(ProtocolVersion.SSL2);
toTestList.add(ProtocolVersion.SSL3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ public void setDTLS(boolean dtls) {
@Override
public void applyDelegate(Config config) throws ConfigurationException {
if (dtls) {
config.setHighestProtocolVersion(ProtocolVersion.DTLS12);
config.setDefaultSelectedProtocolVersion(ProtocolVersion.DTLS12);
ProtocolVersion version =
config.getHighestProtocolVersion().is13()
? ProtocolVersion.DTLS13
: ProtocolVersion.DTLS12;
config.setHighestProtocolVersion(version);
config.setDefaultSelectedProtocolVersion(version);
config.setSupportedVersions(version);

if (config.getDefaultClientConnection() == null) {
config.setDefaultClientConnection(new OutboundConnection());
Expand All @@ -51,7 +56,11 @@ public void applyDelegate(Config config) throws ConfigurationException {

config.setDefaultLayerConfiguration(StackConfiguration.DTLS);
config.setWorkflowExecutorType(WorkflowExecutorType.DTLS);
config.setFinishWithCloseNotify(true);
config.setFinishWithCloseNotify(!version.isDTLS13());
if (version.isDTLS13()) {
config.setTls13BackwardsCompatibilityMode(false);
config.setDtlsCookieExchange(false);
}
config.setIgnoreRetransmittedCssInDtls(true);
config.setAddRetransmissionsToWorkflowTraceInDtls(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public List<CipherSuite> getToTestCipherSuitesByVersion(
if (version == ProtocolVersion.SSL3) {
return (List<CipherSuite>) CipherSuite.SSL3_SUPPORTED_CIPHERSUITES;
}
if (version == ProtocolVersion.TLS13) {
if (version.is13()) {
return CipherSuite.getImplementedTls13CipherSuites();
}
List<CipherSuite> realCipherSuites =
Expand Down Expand Up @@ -415,6 +415,9 @@ public void configureVersions(TlsScanReport report) {
if (report.getResult(TlsAnalyzedProperty.SUPPORTS_DTLS_1_2) == TestResults.TRUE) {
getProtocolVersions().add(ProtocolVersion.DTLS12);
}
if (report.getResult(TlsAnalyzedProperty.SUPPORTS_DTLS_1_3) == TestResults.TRUE) {
getProtocolVersions().add(ProtocolVersion.DTLS13);
}
if (report.getResult(TlsAnalyzedProperty.SUPPORTS_SSL_3) == TestResults.TRUE) {
getProtocolVersions().add(ProtocolVersion.SSL3);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ public void adjustConfig(ServerReport report) {
if (report.getResult(TlsAnalyzedProperty.SUPPORTS_GOST) == TestResults.FALSE) {
scanForGostCert = false;
}
if (report.getResult(TlsAnalyzedProperty.SUPPORTS_TLS_1_3) != TestResults.TRUE) {
if (report.getResult(TlsAnalyzedProperty.SUPPORTS_TLS_1_3) != TestResults.TRUE
&& report.getResult(TlsAnalyzedProperty.SUPPORTS_DTLS_1_3) != TestResults.TRUE) {
scanForTls13 = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected void executeTest() {
evaluationHelper.setPairLists(new LinkedList<>());
for (ProtocolVersion version : evaluationHelper.getProtocolVersions()) {
LOGGER.debug("Testing: {}", version);
if (version.isTLS13()) {
if (version.is13()) {
evaluationHelper
.getPairLists()
.add(new VersionSuiteListPair(version, getSupportedTls13CipherSuites()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import de.rub.nds.tlsattacker.core.constants.ProtocolVersion;
import de.rub.nds.tlsattacker.core.constants.SignatureAndHashAlgorithm;
import de.rub.nds.tlsattacker.core.protocol.message.ClientHelloMessage;
import de.rub.nds.tlsattacker.core.protocol.message.FinishedMessage;
import de.rub.nds.tlsattacker.core.protocol.message.HelloVerifyRequestMessage;
import de.rub.nds.tlsattacker.core.protocol.message.ServerHelloDoneMessage;
import de.rub.nds.tlsattacker.core.protocol.message.ServerHelloMessage;
Expand Down Expand Up @@ -169,7 +170,11 @@ private WorkflowTrace getWorkflowTrace(Config config, ClientHelloMessage clientH
trace.addTlsAction(new ReceiveAction(new HelloVerifyRequestMessage()));
trace.addTlsAction(new SendAction(clientHello));
}
trace.addTlsAction(new ReceiveTillAction(new ServerHelloDoneMessage()));
trace.addTlsAction(
new ReceiveTillAction(
config.getHighestProtocolVersion().is13()
? new FinishedMessage()
: new ServerHelloDoneMessage()));
return trace;
}

Expand All @@ -180,8 +185,11 @@ private TestResult getResult(Config config, WorkflowTrace trace, boolean checkFo
return checkForTrue
== (WorkflowTraceResultUtil.didReceiveMessage(
trace, HandshakeMessageType.SERVER_HELLO_DONE)
|| (state.getTlsContext().getSelectedProtocolVersion()
== ProtocolVersion.TLS13
|| ((state.getTlsContext().getSelectedProtocolVersion()
== ProtocolVersion.TLS13
|| state.getTlsContext()
.getSelectedProtocolVersion()
== ProtocolVersion.DTLS13)
&& (WorkflowTraceResultUtil.didReceiveMessage(
trace, HandshakeMessageType.FINISHED))))
? TestResults.TRUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ public List<ExtensionType> getSupportedExtensions() {
}
}
if (supportsTls13) {
commonExtensions = getCommonExtension(ProtocolVersion.TLS13, CipherSuite::isTls13);
commonExtensions =
getCommonExtension(
configSelector.getTls13BaseConfig().getHighestProtocolVersion(),
CipherSuite::isTls13);
if (commonExtensions != null) {
allSupportedExtensions.addAll(commonExtensions);
}
Expand All @@ -107,7 +110,7 @@ private boolean supportsSni() {
private List<ExtensionType> getCommonExtension(
ProtocolVersion highestVersion, Predicate<CipherSuite> cipherSuitePredicate) {
Config tlsConfig;
if (highestVersion.isTLS13()) {
if (highestVersion.is13()) {
tlsConfig = configSelector.getTls13BaseConfig();
} else {
tlsConfig = configSelector.getBaseConfig();
Expand Down Expand Up @@ -169,7 +172,9 @@ public Requirement<ServerReport> getRequirements() {
@Override
public void adjustConfig(ServerReport report) {
supportsTls13 =
TestResults.TRUE.equals(report.getResult(TlsAnalyzedProperty.SUPPORTS_TLS_1_3));
TestResults.TRUE.equals(report.getResult(TlsAnalyzedProperty.SUPPORTS_TLS_1_3))
|| TestResults.TRUE.equals(
report.getResult(TlsAnalyzedProperty.SUPPORTS_DTLS_1_3));
supportsPreTls13 =
report.getResult(TlsAnalyzedProperty.SUPPORTS_TLS_1_0) == TestResults.TRUE
|| report.getResult(TlsAnalyzedProperty.SUPPORTS_TLS_1_1)
Expand Down
Loading