Skip to content

Implementation of RA-learning without parameters. #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -636,3 +636,53 @@ jobs:
run: |
java -jar target/dtls-fuzzer.jar args/wolfssl/learn_wolfssl_client_dhe_cert_req_DTLS13 -Dwolfssl.version=5.7.6 -roundLimit 8
experiments/scripts/diff_hyps.sh experiments/models/regression/clients/rounds/wolfssl-5.7.6_client_dhe_cert_req_DTLS13 output/wolfssl-5.7.6_client_dhe_cert_req_DTLS13 8

Scandium-2-6-2_Server_psk_ra:
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Install DTLS-Fuzzer
run: ./install.sh

- name: Setup SUT
run: ./setup_sut.sh scandium-2.6.2

- name: Test scandium-2.6.2 Server (server_psk_ra)
run: |
java -jar target/dtls-fuzzer-0.3-SNAPSHOT-ra-jar-with-dependencies.jar args/scandium/learn_scandium_server_psk_ra -Dscandium.version=2.6.2 -roundLimit 5

CTinyDTLS_Server_psk_ra:
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Install DTLS-Fuzzer
run: ./install.sh

- name: Setup SUT
run: ./setup_sut.sh ctinydtls

- name: Test Contiki-NG TinyDTLS Server (psk)
run: |
java -jar target/dtls-fuzzer-0.3-SNAPSHOT-ra-jar-with-dependencies.jar args/ctinydtls/learn_ctinydtls_server_psk_ra -roundLimit 5
31 changes: 31 additions & 0 deletions args/ctinydtls/learn_ctinydtls_server_psk_ra
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
state-fuzzer-server

# SUT config
-connect
localhost:${sul.port}
-startWait
100
-alphabet
${alphabets.servers}/psk8_ra.xml
-responseWait
100
-protocol
DTLS12

# learning config
-learningAlgorithm
RaStar
-equivalenceAlgorithms
IO_RANDOM_WALK
-seedTransitions
-logQueries
-maxDepthRA
10
-probNewDataValue
0.5
-seed
7
-output
output/ctinydtls_server_psk_ra
-cmd
${fuzzer.dir}/suts/ctinydtls/tests/dtls-server -p ${sul.port}
42 changes: 42 additions & 0 deletions args/scandium/learn_scandium_server_psk_ra
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
state-fuzzer-server

# SUT config
-connect
localhost:${sul.port}
-startWait
4000
-responseWait
500
-protocol
DTLS12
-cmd
java -jar ${fuzzer.dir}/suts/scandium-${scandium.version}-dtls-clientserver.jar -port ${sul.port} -trustLocation ${keystore}/ec_secp256r1.jks -trustPassword password -trustAlias dtls-fuzzer -keyLocation ${keystore}/ec_secp256r1.jks -keyPassword password -keyAlias dtls-fuzzer -timeout 20000000 -cipherSuites TLS_PSK_WITH_AES_128_CCM_8,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 -starterAddress localhost:${fuzzer.port}
-sulConfig
experiments/configs/scandium.config
-adapterPort
${fuzzer.port}
-processTrigger
START



# learning config
-alphabet
${alphabets.servers}/scandium_psk_ra.xml
-learningAlgorithm
RaStar
-equivalenceAlgorithms
IO_RANDOM_WALK
-seedTransitions
-logQueries
-maxDepthRA
15
-probNewDataValue
0.5
-seed
7
-output
output/scandium-${scandium.version}_server_psk_ra
-ceReruns
3
-skipNonDetTests
38 changes: 38 additions & 0 deletions examples/alphabets/servers/psk8_ra.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- DTLS alphabet comprising the messages necessary to perform PSK handshakes
using CCM_8 ciphersuites. -->
<alphabet>
<ClientHelloInput suite="TLS_PSK_WITH_AES_128_CCM_8" name="PSK_CLIENT_HELLO"/>
<ClientKeyExchangeInput name="PSK_CLIENT_KEY_EXCHANGE" algorithm="PSK"/>
<ChangeCipherSpecInput/>
<FinishedInput name="FINISHED"/>
<GenericTlsInput name="APPLICATION">
<Application>
<data>
<byteArrayExplicitValueModification>
<!--HEX(This is a hello message!)-->
<explicitValue>0x5468697320697320612068656c6c6f206d65737361676521</explicitValue>
</byteArrayExplicitValueModification>
</data>
</Application>
</GenericTlsInput>
<AlertInput name="Alert(WARNING,CLOSE_NOTIFY)" level="WARNING" description="CLOSE_NOTIFY"/>
<AlertInput name="Alert(FATAL,UNEXPECTED_MESSAGE)" level="FATAL" description="UNEXPECTED_MESSAGE"/>
<!-- Output symbols -->
<!-- Messages -->
<RAOutputSymbol name="HELLO_VERIFY_REQUEST"/>
<RAOutputSymbol name="SERVER_HELLO|SERVER_HELLO_DONE"/>
<RAOutputSymbol name="APPLICATION"/>
<RAOutputSymbol name="CHANGE_CIPHER_SPEC|FINISHED"/>
<RAOutputSymbol name="CHANGE_CIPHER_SPEC|FINISHED|APPLICATION"/>
<!-- Alerts -->
<RAOutputSymbol name="Alert(WARNING,CLOSE_NOTIFY)"/>
<RAOutputSymbol name="Alert(FATAL,CLOSE_NOTIFY)"/>
<RAOutputSymbol name="Alert(WARNING,NO_RENEGOTIATION)"/>
<RAOutputSymbol name="Alert(FATAL,INTERNAL_ERROR)"/>
<RAOutputSymbol name="Alert(FATAL,HANDSHAKE_FAILURE)"/>
<RAOutputSymbol name="Alert(FATAL,UNEXPECTED_MESSAGE)"/>
<RAOutputSymbol name="Alert(FATAL,DECRYPT_ERROR)"/>
<!--Special symbols -->
<RAOutputSymbol name="TIMEOUT"/>
<RAOutputSymbol name="SOCKET_CLOSED"/>
</alphabet>
34 changes: 34 additions & 0 deletions examples/alphabets/servers/scandium_psk_ra.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!-- DTLS alphabet comprising the messages necessary to perform PSK and ECDHE handshakes
using CCM_8 ciphersuites. -->
<alphabet>
<ClientHelloInput suite="TLS_PSK_WITH_AES_128_CCM_8" name="PSK_CLIENT_HELLO" extendedWait="300"/>
<ClientKeyExchangeInput name="PSK_CLIENT_KEY_EXCHANGE" algorithm="PSK"/>
<ChangeCipherSpecInput/>
<FinishedInput name="FINISHED" extendedWait="300"/>
<GenericTlsInput name="APPLICATION">
<Application>
<data>
<byteArrayExplicitValueModification>
<!--HEX(This is a hello message!)-->
<explicitValue>0x5468697320697320612068656c6c6f206d65737361676521</explicitValue>
</byteArrayExplicitValueModification>
</data>
</Application>
</GenericTlsInput>
<!--AlertInput name="Alert(WARNING,CLOSE_NOTIFY)" level="WARNING" description="CLOSE_NOTIFY"/>
<AlertInput name="Alert(FATAL,UNEXPECTED_MESSAGE)" level="FATAL" description="UNEXPECTED_MESSAGE"/-->
<!-- Output symbols -->
<!-- Messages -->
<RAOutputSymbol name="HELLO_VERIFY_REQUEST"/>
<RAOutputSymbol name="SERVER_HELLO|SERVER_HELLO_DONE"/>
<RAOutputSymbol name="APPLICATION"/>
<RAOutputSymbol name="CHANGE_CIPHER_SPEC|FINISHED"/>
<RAOutputSymbol name="CHANGE_CIPHER_SPEC|FINISHED|APPLICATION"/>
<!-- Alerts -->
<RAOutputSymbol name="Alert(WARNING,CLOSE_NOTIFY)"/>
<RAOutputSymbol name="Alert(WARNING,NO_RENEGOTIATION)"/>
<RAOutputSymbol name="Alert(FATAL,INTERNAL_ERROR)"/>
<RAOutputSymbol name="Alert(FATAL,HANDSHAKE_FAILURE)"/>
<!--Special symbols -->
<RAOutputSymbol name="TIMEOUT"/>
</alphabet>
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ readonly SCRIPT_DIR
readonly PATCHES_DIR="${SCRIPT_DIR}/experiments/patches"


readonly PROTOCOLSTATEFUZZER_COMMIT="e679d1e"
readonly PROTOCOLSTATEFUZZER_REP_URL="https://github.com/protocol-fuzzing/protocol-state-fuzzer.git"
readonly PROTOCOLSTATEFUZZER_COMMIT="949e047"
readonly PROTOCOLSTATEFUZZER_REP_URL="https://github.com/00oskpet/protocol-state-fuzzer.git"
readonly PROTOCOLSTATEFUZZER_FOLDER="ProtocolState-Fuzzer"

readonly TLSATTACKER_VERSION="v6.3.4"
Expand Down
78 changes: 58 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<modifiable-variable.version>4.2.2</modifiable-variable.version>
<osgi.version>8.1.0</osgi.version>
<protocol-attacker.version>1.1.5</protocol-attacker.version>
<ralib.version>0.1-SNAPSHOT</ralib.version>
<tlsattacker.core.version>6.3.4</tlsattacker.core.version>
<tlsattacker.transport.version>6.3.4</tlsattacker.transport.version>
<x509-attacker.version>3.1.7</x509-attacker.version>
Expand All @@ -35,6 +36,13 @@
<scope>import</scope>
</dependency>

<!-- Manually installed ralib -->
<dependency>
<groupId>de.learnlib</groupId>
<artifactId>ralib</artifactId>
<version>${ralib.version}</version>
</dependency>

<!-- jcommander -->
<dependency>
<groupId>com.beust</groupId>
Expand Down Expand Up @@ -88,6 +96,11 @@
<artifactId>protocolstatefuzzer</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>de.learnlib</groupId>
<artifactId>ralib</artifactId>
<version>${ralib.version}</version>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
Expand Down Expand Up @@ -173,26 +186,50 @@
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>se.uu.it.dtlsfuzzer.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<!-- uncomment in case to make a jar with dependencies on calling 'mvn install' -->
<!-- <executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions> -->
<executions>
<execution>
<id>build-mealy</id>
<configuration>
<archive>
<manifest>
<mainClass>se.uu.it.dtlsfuzzer.Main</mainClass>
</manifest>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.artifactId}-${project.version}-mealy</finalName>
</configuration>
<goals>
<goal>single</goal>
</goals>
<phase>verify</phase>
</execution>
<execution>
<id>build-RA</id>
<configuration>
<archive>
<manifest>
<mainClass>se.uu.it.dtlsfuzzer.MainRA</mainClass>
</manifest>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.artifactId}-${project.version}-ra</finalName>
</configuration>
<goals>
<goal>single</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -275,6 +312,7 @@
</goals>
<phase>package</phase>
</execution>

</executions>
</plugin>
<!-- Static code analysis -->
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/se/uu/it/dtlsfuzzer/MainRA.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package se.uu.it.dtlsfuzzer;

import com.github.protocolfuzzing.protocolstatefuzzer.entrypoints.CommandLineParser;
import de.rub.nds.tlsattacker.core.util.ProviderUtil;

public class MainRA {

public static void main(String[] args) {
ProviderUtil.addBouncyCastleProvider();
MultiBuilderRA mb = new MultiBuilderRA();
String[] parentLoggers = { Main.class.getPackageName() };

CommandLineParser<?> commandLineParser = new CommandLineParser<>(
mb,
mb,
mb,
mb
);
commandLineParser.setExternalParentLoggers(parentLoggers);

commandLineParser.parse(args, true);
}
}
Loading