Skip to content

Commit 9e88f9c

Browse files
committed
Merge master into raw_publickeys
Conflicts: TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/workflow/action/executor/ReceiveMessageHelper.java
2 parents af834c5 + 5a767e4 commit 9e88f9c

File tree

69 files changed

+2786
-947
lines changed

Some content is hidden

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

69 files changed

+2786
-947
lines changed

.idea/codeStyles/codeStyleConfig.xml

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

Attacks/nbactions.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
1111
</goals>
1212
<properties>
13-
<exec.args>-classpath %classpath de.rub.nds.tlsattacker.attacks.Main -loglevel DEBUG padding_oracle -connect adobe.com:443 -cipher TLS_RSA_WITH_AES_128_CBC_SHA -vectorEngine FINISHED</exec.args>
13+
<exec.args>-classpath %classpath de.rub.nds.tlsattacker.attacks.Main -debug invalid_curve -connect 10.0.2.4:8443 -ephemeral -point_format ANSIX962_COMPRESSED_PRIME</exec.args>
1414
<exec.executable>java</exec.executable>
1515
</properties>
1616
</action>
@@ -24,7 +24,7 @@
2424
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
2525
</goals>
2626
<properties>
27-
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath de.rub.nds.tlsattacker.attacks.Main -loglevel DEBUG padding_oracle -connect adobe.com:443 -cipher TLS_RSA_WITH_AES_128_CBC_SHA -vectorEngine FINISHED</exec.args>
27+
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath de.rub.nds.tlsattacker.attacks.Main -debug invalid_curve -connect 10.0.2.4:8443 -ephemeral -point_format ANSIX962_COMPRESSED_PRIME</exec.args>
2828
<exec.executable>java</exec.executable>
2929
<jpda.listen>true</jpda.listen>
3030
</properties>
@@ -39,7 +39,7 @@
3939
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
4040
</goals>
4141
<properties>
42-
<exec.args>-classpath %classpath de.rub.nds.tlsattacker.attacks.Main -loglevel DEBUG padding_oracle -connect adobe.com:443 -cipher TLS_RSA_WITH_AES_128_CBC_SHA -vectorEngine FINISHED</exec.args>
42+
<exec.args>-classpath %classpath de.rub.nds.tlsattacker.attacks.Main -debug invalid_curve -connect 10.0.2.4:8443 -ephemeral -point_format ANSIX962_COMPRESSED_PRIME</exec.args>
4343
<exec.executable>java</exec.executable>
4444
</properties>
4545
</action>

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

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@
1515
import de.rub.nds.tlsattacker.core.config.Config;
1616
import de.rub.nds.tlsattacker.core.config.converters.BigIntegerConverter;
1717
import de.rub.nds.tlsattacker.core.config.converters.NamedGroupConverter;
18+
import de.rub.nds.tlsattacker.core.config.converters.PointFormatConverter;
1819
import de.rub.nds.tlsattacker.core.config.delegate.CiphersuiteDelegate;
1920
import de.rub.nds.tlsattacker.core.config.delegate.ClientDelegate;
2021
import de.rub.nds.tlsattacker.core.config.delegate.GeneralDelegate;
2122
import de.rub.nds.tlsattacker.core.config.delegate.ProtocolVersionDelegate;
2223
import de.rub.nds.tlsattacker.core.config.delegate.StarttlsDelegate;
2324
import de.rub.nds.tlsattacker.core.constants.CipherSuite;
25+
import de.rub.nds.tlsattacker.core.constants.ECPointFormat;
2426
import de.rub.nds.tlsattacker.core.constants.NamedGroup;
27+
import de.rub.nds.tlsattacker.core.constants.ProtocolVersion;
28+
import de.rub.nds.tlsattacker.core.crypto.ec.EllipticCurveOverFp;
2529
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowTraceType;
2630
import java.math.BigInteger;
2731
import java.util.LinkedList;
@@ -85,6 +89,25 @@ public class InvalidCurveAttackConfig extends AttackConfig {
8589
@ParametersDelegate
8690
private StarttlsDelegate starttlsDelegate;
8791

92+
/**
93+
* The twisted curve to simulate server's x-only ladder
94+
*/
95+
private EllipticCurveOverFp twistedCurve;
96+
97+
private boolean curveTwistAttack = false;
98+
99+
@Parameter(names = "-curve_twist_d", hidden = true, description = "Non quadratic residue used to obtain twisted curve", converter = BigIntegerConverter.class)
100+
private BigInteger curveTwistD;
101+
102+
/**
103+
* Ignore server's preferences and use the specified PointFormat instead
104+
*/
105+
@Parameter(names = "-point_format", description = "The format used for the public key", converter = PointFormatConverter.class)
106+
private ECPointFormat pointCompressionFormat = ECPointFormat.UNCOMPRESSED;
107+
108+
@Parameter(names = "-renegotiation", description = "If set to true, the attack will be carried out in a renegotiation handshake")
109+
private boolean attackInRenegotiation = false;
110+
88111
/**
89112
*
90113
* @param delegate
@@ -163,7 +186,7 @@ public NamedGroup getNamedGroup() {
163186
*
164187
* @param namedGroup
165188
*/
166-
public void setNamedCurve(NamedGroup namedGroup) {
189+
public void setNamedGroup(NamedGroup namedGroup) {
167190
this.namedGroup = namedGroup;
168191
}
169192

@@ -256,6 +279,36 @@ public boolean isExecuteAttack() {
256279
return attackDelegate.isExecuteAttack();
257280
}
258281

282+
/**
283+
* @return the curveTwistAttack
284+
*/
285+
public boolean isCurveTwistAttack() {
286+
return curveTwistAttack;
287+
}
288+
289+
/**
290+
* @param curveTwistAttack
291+
* the curveTwistAttack to set
292+
*/
293+
public void setCurveTwistAttack(boolean curveTwistAttack) {
294+
this.curveTwistAttack = curveTwistAttack;
295+
}
296+
297+
/**
298+
* @return the twistedCurve
299+
*/
300+
public EllipticCurveOverFp getTwistedCurve() {
301+
return twistedCurve;
302+
}
303+
304+
/**
305+
* @param twistedCurve
306+
* the twistedCurve to set
307+
*/
308+
public void setTwistedCurve(EllipticCurveOverFp twistedCurve) {
309+
this.twistedCurve = twistedCurve;
310+
}
311+
259312
/**
260313
*
261314
* @return
@@ -303,4 +356,49 @@ public Config createConfig() {
303356
config.setWorkflowTraceType(WorkflowTraceType.HANDSHAKE);
304357
return config;
305358
}
359+
360+
/**
361+
* @return the curveTwistD
362+
*/
363+
public BigInteger getCurveTwistD() {
364+
return curveTwistD;
365+
}
366+
367+
/**
368+
* @param curveTwistD
369+
* the curveTwistD to set
370+
*/
371+
public void setCurveTwistD(BigInteger curveTwistD) {
372+
this.curveTwistD = curveTwistD;
373+
}
374+
375+
/**
376+
* @return the pointCompressionFormat
377+
*/
378+
public ECPointFormat getPointCompressionFormat() {
379+
return pointCompressionFormat;
380+
}
381+
382+
/**
383+
* @param pointCompressionFormat
384+
* the pointCompressionFormat to set
385+
*/
386+
public void setPointCompressionFormat(ECPointFormat pointCompressionFormat) {
387+
this.pointCompressionFormat = pointCompressionFormat;
388+
}
389+
390+
/**
391+
* @return the attackInRenegotiation
392+
*/
393+
public boolean isAttackInRenegotiation() {
394+
return attackInRenegotiation;
395+
}
396+
397+
/**
398+
* @param attackInRenegotiation
399+
* the attackInRenegotiation to set
400+
*/
401+
public void setAttackInRenegotiation(boolean attackInRenegotiation) {
402+
this.attackInRenegotiation = attackInRenegotiation;
403+
}
306404
}
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/**
2+
* TLS-Attacker - A Modular Penetration Testing Framework for TLS
3+
*
4+
* Copyright 2014-2017 Ruhr University Bochum / Hackmanit GmbH
5+
*
6+
* Licensed under Apache License 2.0
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*/
9+
/*
10+
*/
11+
package de.rub.nds.tlsattacker.attacks.ec;
12+
13+
import de.rub.nds.tlsattacker.core.constants.NamedGroup;
14+
import java.math.BigInteger;
15+
16+
/**
17+
*
18+
*/
19+
public enum InvalidCurvePoint {
20+
21+
SECP160K1(new BigInteger("6F6118AE7199611C0B4F95CFE3B7DEDA68301E69", 16), new BigInteger(
22+
"F6F9D0E04364C716C25263D7E44CA6C571D22597", 16), new BigInteger("5"), NamedGroup.SECP160K1),
23+
SECP160R1(new BigInteger("D465C0476AE02C499B0561B9C752C5CFEE8501ED", 16), new BigInteger(
24+
"5B6394C2C94D9214417E722792D0C07617CC31A6", 16), new BigInteger("5"), NamedGroup.SECP160R1),
25+
SECP160R2(new BigInteger("2790AABFE83C792584D45D5259ECCA28843D56AA", 16), new BigInteger(
26+
"5DE5B6B1EC7BDA3940ABA6AD9AE01008040D5949", 16), new BigInteger("5"), NamedGroup.SECP160R2),
27+
SECP192K1(new BigInteger("7E89D82546F6EDC79CB91F2646E8D7E7AB3FC2F971F1713C", 16), new BigInteger(
28+
"8A62DA9766C50A90A776C599C421632B46CA9878AB55AF19", 16), new BigInteger("7"), NamedGroup.SECP192K1),
29+
SECP192R1(new BigInteger("F6DA5E72B35D837EDCDD6E8D211BDBB6565B9708D0447400", 16), new BigInteger(
30+
"ED15E29256077E3D25C26753FEE705C02FFC0DC8EFDA443A", 16), new BigInteger("5"), NamedGroup.SECP192R1),
31+
SECP224K1(new BigInteger("54510A6A85EF6144CA057E159DD83C240E3A69B06EE2CAC06BD25AC7", 16), new BigInteger(
32+
"D2799F20E14C33AB704203F75EBDB38471919531970090DE8D12BC95", 16), new BigInteger("7"), NamedGroup.SECP224K1),
33+
SECP224R1(new BigInteger("A02F6D2FEBD6C53F11737C43EDDAF9A5026A21245DACA9342CFF7247", 16), new BigInteger(
34+
"3B0781466C19DCCCAD13A2591A4DFAB7DADF210E9A150CE0C00137D9", 16), new BigInteger("5"), NamedGroup.SECP224R1),
35+
SECP256K1(
36+
new BigInteger("5748979A06D28004D165F01FCA69C80DECAFB0119BA2A7C4C7F84C7AF2DCA311", 16),
37+
new BigInteger("D9625DF3DC92015DEB22AC7242ABEBE512B195E973BA657203F1BDEE8662B45A", 16),
38+
new BigInteger("7"),
39+
NamedGroup.SECP256K1),
40+
SECP256R1(
41+
new BigInteger("21D2EFDDCFDF5C96268A16A8D5B8CB49EAD2DDE206259FE98686188A30CF0339", 16),
42+
new BigInteger("D440D09110D30D6CC3CDBBC38284109DB3ACA31F3C6717E29F1CE9D4088D4B1C", 16),
43+
new BigInteger("5"),
44+
NamedGroup.SECP256R1),
45+
SECP384R1(
46+
new BigInteger(
47+
"B68083A3FE4F9E46B78D7EDA7DD98FBB712EF7C9899F728D9633A3688B6DE446366668EA1E6CF80996B046719DAD63FF",
48+
16), new BigInteger(
49+
"FC00B0AFDC553D8A01336C78527231BF2D7C8BAD862225A07761BD0975E968E72204EBF877D9F67A22883512884BA870",
50+
16), new BigInteger("5"), NamedGroup.SECP384R1),
51+
SECP521R1(
52+
new BigInteger(
53+
"E04ED20B3289E72B4916D3C9095785488D309571BA7E39E0033DB72B471976133EE387F812A0DC2DE796A2C65ACCC220C2E11805FCADAF7F2D29826DF83C0B487F",
54+
16),
55+
new BigInteger(
56+
"7555B523F2A83D26CF76E8BF6F3BD55A6BD7307D617D10F7228ED84920C2832F5AB78472FB1E54E572703E70FB84F4F956F2AA2027F0156DDE1CCE729BA135B02C",
57+
16),
58+
new BigInteger("5"),
59+
NamedGroup.SECP521R1),
60+
BRAINPOOLP256R1(
61+
new BigInteger("475638180469F3128FCEACFF3D1B2A7052021FABE168456E724C82CE647A0B38", 16),
62+
new BigInteger("24392E4B249529608415683ABF8DF8017A577A447B791233BFF1F8D50003C3DA", 16),
63+
new BigInteger("5"),
64+
NamedGroup.BRAINPOOLP256R1),
65+
BRAINPOOLP384R1(
66+
new BigInteger(
67+
"7A15487AF637530E2BECC85585C2E36C21447AB4C786F08EF75A1EFBE7785016855AB3B6EFBB9F80517C23C1438A3F18",
68+
16), new BigInteger(
69+
"1C8AC00FBE2E3CD0994704AC81F8210A283F34D4F351F19525876A14719B8DDAC45315782BB7BBEAB47B0B6061788A9D",
70+
16), new BigInteger("5"), NamedGroup.BRAINPOOLP384R1),
71+
BRAINPOOLP512R1(
72+
new BigInteger(
73+
"3A52E57C2D5BE39BB3F97C4CF90D81BEE7123CACBC6B7FF6EB03A164CCF0253FDF1AACF7C4AC6B820E6D48145D7854C67DEF4CADAB555D4609E279956450A610",
74+
16),
75+
new BigInteger(
76+
"1C41E102D5E9EF09CA132E808D87D1C0944951572E82C4F9FECACC80714C0C926E5DA09BD775F5C7E2BE54878EE2AC1A091A8653AE9961789202FD2BA21E7999",
77+
16),
78+
new BigInteger("5"),
79+
NamedGroup.BRAINPOOLP512R1);
80+
81+
private BigInteger publicPointBaseX;
82+
private BigInteger publicPointBaseY;
83+
private final NamedGroup namedGroup;
84+
private BigInteger order;
85+
86+
private InvalidCurvePoint(BigInteger publicPointBaseX, BigInteger publicPointBaseY, BigInteger order,
87+
NamedGroup namedGroup) {
88+
this.publicPointBaseX = publicPointBaseX;
89+
this.publicPointBaseY = publicPointBaseY;
90+
this.order = order;
91+
this.namedGroup = namedGroup;
92+
}
93+
94+
public static InvalidCurvePoint fromNamedGroup(NamedGroup group) {
95+
for (InvalidCurvePoint point : values()) {
96+
if (point.getNamedGroup() == group) {
97+
return point;
98+
}
99+
}
100+
return null;
101+
}
102+
103+
public NamedGroup getNamedGroup() {
104+
return namedGroup;
105+
}
106+
107+
public BigInteger getOrder() {
108+
return order;
109+
}
110+
111+
/**
112+
* @return the publicPointBaseX
113+
*/
114+
public BigInteger getPublicPointBaseX() {
115+
return publicPointBaseX;
116+
}
117+
118+
/**
119+
* @param publicPointBaseX
120+
* the publicPointBaseX to set
121+
*/
122+
public void setPublicPointBaseX(BigInteger publicPointBaseX) {
123+
this.publicPointBaseX = publicPointBaseX;
124+
}
125+
126+
/**
127+
* @return the publicPointBaseY
128+
*/
129+
public BigInteger getPublicPointBaseY() {
130+
return publicPointBaseY;
131+
}
132+
133+
/**
134+
* @param publicPointBaseY
135+
* the publicPointBaseY to set
136+
*/
137+
public void setPublicPointBaseY(BigInteger publicPointBaseY) {
138+
this.publicPointBaseY = publicPointBaseY;
139+
}
140+
141+
/**
142+
* @param order
143+
* the order to set
144+
*/
145+
public void setOrder(BigInteger order) {
146+
this.order = order;
147+
}
148+
149+
}

0 commit comments

Comments
 (0)