Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
8f0da66
Fix storeTrace() (used for option -workflow_output), so it works as
C0D3D3V Oct 12, 2024
17ca854
remove unused catch block from SSH-MITM run()
C0D3D3V Oct 12, 2024
d49fffa
Add storeConfig() to class Config, this method serializes and stores …
C0D3D3V Oct 12, 2024
1543253
Fix deserialization of hostKeys and userKeys, when loading config fro…
C0D3D3V Oct 23, 2024
2b81a8c
Fix deserialization of AbstractExtension. JAXB needs to know where to…
C0D3D3V Oct 23, 2024
39089e7
Add abstract DynamicMessageAction, that provides common methodes for
C0D3D3V Oct 23, 2024
d57167b
remove ToDo: RsaKeyExchangePubkeyMessageSerializer is already
C0D3D3V Oct 23, 2024
f51b718
add calls to set executed in Actions where they were missing.
C0D3D3V Oct 23, 2024
b975882
Make the FULL workflow actually compete as planned.
C0D3D3V Oct 23, 2024
d3b0c0f
Add IGNORE_UNEXPECTED_CHANNEL_WINDOW_ADJUSTS option to ReceiveAction, so
C0D3D3V Oct 23, 2024
fbef037
Use XmlElements in Config instead of XmlSeeAlso in AbstractExtension,…
C0D3D3V Oct 23, 2024
6a6b937
Fix setReceivedPackets() of ReceiveAction
C0D3D3V Oct 23, 2024
7999be1
Add new WorkflowTraceType: REQ_TCP_IP_FORWARD
C0D3D3V Oct 24, 2024
9090b4f
Fix Serializer of GlobalRequestSuccessMessages. Allow it to have no r…
C0D3D3V Oct 25, 2024
16e561d
Improved ChannelManager to handle channels better, added some helper …
C0D3D3V Oct 25, 2024
7ccbc27
Move adjustContext() to the common position in the ChannelRequestHand…
C0D3D3V Oct 25, 2024
479d8ba
Add -log_level option to set explicit log level. Overwrites -debug an…
C0D3D3V Oct 28, 2024
e07a7ba
- Use getObject() in BinaryPacketPreparator.
C0D3D3V Oct 28, 2024
623e903
[Channel]
C0D3D3V Oct 28, 2024
8255be5
Implement parsing and serialization of data packets send over Channel…
C0D3D3V Oct 29, 2024
be87f3b
Add checks if Data Layer consumed all bytes of ChannelDataMessages
C0D3D3V Oct 29, 2024
31f0dd4
[SFTP]
C0D3D3V Oct 30, 2024
0ef2d0b
Add SSH_FXP_OPEN Message
C0D3D3V Oct 30, 2024
ef9c3a1
Use Lazy Logging:
C0D3D3V Oct 30, 2024
faced74
Added SFTP: Close, Read, Remove, Rename, Write Messages
C0D3D3V Oct 31, 2024
5ebb349
Fix typo Sfpt to Sftp
C0D3D3V Oct 31, 2024
965cc4f
Added SFTP ReadDir Message
C0D3D3V Oct 31, 2024
5d232fe
Fix some method visibility
C0D3D3V Oct 31, 2024
6b33439
Add missing SFTP Requests and Responses from protocol version 3
C0D3D3V Oct 31, 2024
1417daa
Add missing SFTP Extension Announcments
C0D3D3V Nov 1, 2024
894cb1b
move SFTP Requests and Responses to sub packages
C0D3D3V Nov 1, 2024
1e3fa62
add most of missing Extended requests. check-file-handle, check-file-…
C0D3D3V Nov 1, 2024
08b101d
move extended Requests into extended_request package
C0D3D3V Nov 2, 2024
b265f19
Add missing SFTP extended Responses
C0D3D3V Nov 2, 2024
3d40f37
Use Lazy logging for nearly everything related to Serializer
C0D3D3V Nov 2, 2024
0ecd981
Use lazy logging for nearly all parser methods.
C0D3D3V Nov 2, 2024
20df64b
Fix serialization of SFTP Messages
C0D3D3V Nov 3, 2024
d28ab88
Add basic SFTP Manager
C0D3D3V Nov 3, 2024
9619416
Merge remote-tracking branch 'origin/main' into daniel-main-merge
C0D3D3V Nov 3, 2024
a2a6374
log signature as hex string too
C0D3D3V Nov 3, 2024
f547c24
Add SFTP v4 support
C0D3D3V Nov 4, 2024
46024f7
Add missing jakarta xml decorator for SftpRequestTextSeekMessage
C0D3D3V Nov 4, 2024
588f9c7
Make some fields private. Found using spotbugs.
C0D3D3V Nov 7, 2024
3bbc2c9
Remove duplicated comment
C0D3D3V Nov 7, 2024
9a1f4b9
Close open file handles when serializing or parsing Config or Workflo…
C0D3D3V Nov 9, 2024
a110aa7
Add missing XmlElement entries in config for (SFTP) extensions.
C0D3D3V Nov 14, 2024
00f7395
Replace Lists of ModifiableVariable with Lists of ModifiableVariableH…
C0D3D3V Nov 25, 2024
dddfd18
Fix all getAllModifiableVariableHolders() methods
C0D3D3V Nov 25, 2024
a1682b7
run formatter
C0D3D3V Nov 25, 2024
6f15f56
Fix getHandler() of all extended SftpRequests
C0D3D3V Nov 27, 2024
7a5974e
Fix the check if a field is not set in the preparators:
C0D3D3V Nov 27, 2024
05600a1
run formatter
C0D3D3V Nov 27, 2024
cc4b26f
fix respectSftpAttributesFlags, before it did the opposite.
C0D3D3V Nov 28, 2024
b13eb51
Add setSoftly methods to nearly all messages
C0D3D3V Nov 28, 2024
71710e8
Add Copy Constructor to all messages.
C0D3D3V Dec 2, 2024
188179a
Add AuthenticationPrompt and AuthenticationResponse Holders
C0D3D3V Dec 2, 2024
bd5f4fa
Fix Tests and some messages
C0D3D3V Dec 2, 2024
b87b67b
Add copy methods to all Actions
C0D3D3V Dec 2, 2024
d2888eb
Add createCopy Method to Connection
C0D3D3V Dec 2, 2024
1b2429e
Add Copy Constructor for Config and WorkflowTrace
C0D3D3V Dec 2, 2024
db3f8c9
run formatter
C0D3D3V Dec 2, 2024
0ac9b2e
Use ModifiablePath for path variables
C0D3D3V Dec 4, 2024
b4bb644
Make it optional to reset modifiable variables in workflow trace.
C0D3D3V Dec 12, 2024
78be9de
Fix copy constructor of Config. And set initial capacity on copy cons…
C0D3D3V Dec 13, 2024
05cea3c
Remove two annotations
C0D3D3V Dec 13, 2024
1834706
Add extra workflow trace factory options for sftp
C0D3D3V Dec 14, 2024
8bc3e89
Fix normalize of WorkflowTrace
C0D3D3V Dec 15, 2024
ee50815
Add to some actions toString() methods
C0D3D3V Dec 15, 2024
2909f11
Add "not executed" to created toString() methods from last commit
C0D3D3V Dec 15, 2024
955ffe6
Fix toString() again, use for loop. I thought about streams before (w…
C0D3D3V Dec 15, 2024
67fd6ba
Add missing XmlElementWrapper
C0D3D3V Dec 15, 2024
27f8862
Allow fallback to no compression too (similar to fallback to no encry…
C0D3D3V Dec 16, 2024
44e7da7
Add missing methods for UserAuthPkOk and UnknownExtension. Fix Preper…
C0D3D3V Dec 16, 2024
22f2627
Fix UserAuthPasswordMessagePreparator
C0D3D3V Dec 16, 2024
7c0f86d
add some IllegalStringAdapter Annotations
C0D3D3V Dec 16, 2024
303eec1
Prepare messages one after the other, for SendActions with multiple m…
C0D3D3V Dec 16, 2024
3278356
Add cache for config loaded from file
C0D3D3V Dec 16, 2024
cdcdfa1
Use setSoftly...() for ssh connection layer messages
C0D3D3V Dec 18, 2024
69f3893
Use setSoftly...() for ssh authentication layer messages
C0D3D3V Dec 18, 2024
9517dd4
Add prepareBeforeSending option to send method, so ProxyFilterMessage…
C0D3D3V Dec 18, 2024
86fe015
Use setSoftly..() methods for transport layer messages. Except for Ke…
C0D3D3V Dec 19, 2024
bd8bb17
Fix AuthResponseEntry Preparator
C0D3D3V Dec 19, 2024
2b606da
Fix HybridKeyExchangeReplyMessage CyclicDefaultConstructorPairsDynami…
C0D3D3V Dec 19, 2024
8ce68ae
Pass wantReply via argument
C0D3D3V Dec 19, 2024
c118b86
Use setSoftly...() for Key Exchange.
C0D3D3V Dec 19, 2024
ccfa24c
Some refactoring to make the linter happy.
C0D3D3V Dec 19, 2024
726450c
Refactoring of Preparators
C0D3D3V Dec 19, 2024
304271d
Refactoring of some more preparators
C0D3D3V Dec 19, 2024
714bd9a
Add option for preConfiguredAuthPrompts
C0D3D3V Dec 20, 2024
38df12b
Annotate ModifiableVariableHolder, CustomPrivateKey and CustomPublicK…
C0D3D3V Dec 21, 2024
3763df0
fix AuthenticationPromptEntrySerializer
C0D3D3V Dec 21, 2024
3f6a6cb
Fix UserAuthRequestMessagePreparator
C0D3D3V Dec 21, 2024
f6a6245
Use singletons for preparators
C0D3D3V Dec 27, 2024
bda6619
run formatter
C0D3D3V Dec 27, 2024
275d530
Using Singleton for Serializer. Not very happy with it. But at least …
C0D3D3V Dec 27, 2024
96de761
fix serializer tests
C0D3D3V Dec 27, 2024
3a1831d
Create Parser directly instead via Handler
C0D3D3V Dec 28, 2024
43fbbcf
run formatter
C0D3D3V Dec 29, 2024
b3c14d7
Cleanup some redundant code
C0D3D3V Dec 30, 2024
86312d9
Add classes that I forgot to at in last few commits
C0D3D3V Dec 30, 2024
8cfdd17
Some more cleanup
C0D3D3V Dec 30, 2024
acf6375
Fix SFTPv4 Attributes. Times are defined as int64 in the second draft…
C0D3D3V Dec 30, 2024
7be15ea
Rename who to name
C0D3D3V Dec 30, 2024
6111f17
Add some TODO comments, what needs to be done for SFTPv5
C0D3D3V Dec 30, 2024
a1b5706
Revert back to HashSet, since we would need to convert the EnumSet fo…
C0D3D3V Dec 30, 2024
9e0b4f9
Simplify serialization and parsing by removing all DataFormatConstant…
C0D3D3V Dec 30, 2024
c9d3765
some inlineing
C0D3D3V Dec 30, 2024
3e2a625
Use singletons for Handlers
C0D3D3V Jan 1, 2025
737a49e
Use workflowTrace.createCopy instead of WorkflowTrace.copy to create …
C0D3D3V Jan 3, 2025
43fb9c2
Simplify sendMessages, by removing reduce call
C0D3D3V Jan 4, 2025
393a001
Get transportHandler before loop
C0D3D3V Jan 6, 2025
d9910c5
Add a comment for an idea of me for two config options.
C0D3D3V Jan 8, 2025
46de438
Fix global request "want reply". Was not set correctly.
C0D3D3V Jan 8, 2025
ffeaabd
set receivedTransportHandlerException also if IOException happens on …
C0D3D3V Jan 8, 2025
e71a6a0
use lazy logging in ReceiveAction
C0D3D3V Jan 23, 2025
4357336
Do no longer use a ByteArrayOutputStream in PointFormatter. Removed s…
C0D3D3V Jan 27, 2025
73c8537
Add debugging messages to user auth failure and banner. To make it co…
C0D3D3V Jan 29, 2025
5f6c418
Add TODO for Dynamic Key Exchange
C0D3D3V Jan 29, 2025
f8fa25f
Add TODO for AuthenticationProtocolActions
C0D3D3V Jan 29, 2025
d43055f
Add two addSshAction mods to add a list or an array of ssh actions at…
C0D3D3V Jan 30, 2025
58fdf18
Set ChannelType inside ChannelOpenMessage instead of ChannelOpenSessi…
C0D3D3V Jan 31, 2025
88ae92e
Add NoFlowControl Extension
C0D3D3V Jan 31, 2025
c7ce75e
Add some more lazy logging, so it is more unified with the rest of th…
C0D3D3V Jan 31, 2025
d2913f2
Add some more backslashEscapeString on debugging messages for parsed …
C0D3D3V Jan 31, 2025
21e52ab
Rename pFlags to openFlags
C0D3D3V Jan 31, 2025
4dcc02c
Rename pFlags to openFlags
C0D3D3V Jan 31, 2025
23f1cb5
Add handleExtendedResponseMessageParsing()
C0D3D3V Jan 31, 2025
c459aa7
use ModifiableVariableFactory.softlySetValue for the direct softly se…
C0D3D3V Feb 3, 2025
c4e4c41
Use ByteArrayOutputStream in ascii mode
C0D3D3V Feb 3, 2025
26683f9
Add endReceivingEarly option, that could be interesting for fuzzing, …
C0D3D3V Feb 3, 2025
da47d34
Set ReceivedTransportHandlerException flag if we received no message.…
C0D3D3V Feb 3, 2025
ea9c69a
Be more gentle if OQS Module is missing -> Do not exit the program. S…
C0D3D3V Feb 3, 2025
6a55233
Add OpenQuantumSafeConfigurationException
C0D3D3V Feb 3, 2025
3c5c53e
Fallback to unknown sftp packet type
C0D3D3V Feb 4, 2025
c337a41
Use Byte instead of byte for SftpPacketTypeConstant
C0D3D3V Feb 4, 2025
50a7e76
Fix SftpUnknownMessagePreparator. Because I changed the SftpPacketTyp…
C0D3D3V Feb 5, 2025
2483435
Instead of returning ChannelDataMessage separate from Data Messages, …
C0D3D3V Feb 6, 2025
6356439
Print a warning if ChannelCloseMessage was received.
C0D3D3V Feb 6, 2025
2b508ad
fix getFileOrDirectoryHandle()
C0D3D3V Feb 6, 2025
ed2ae0b
fix SftpFileAttributesPreparator and change the way getSftpNegotiated…
C0D3D3V Feb 6, 2025
8d4ed41
Try to fix NullPointerException if we somehow messed up parsing.
C0D3D3V Feb 6, 2025
d9aa148
Add note about cause of parsing error.
C0D3D3V Feb 7, 2025
b6ef164
Put connections and actions inside a workflow trace into a wrapper.
C0D3D3V Feb 7, 2025
a2d9151
Removed versionExchangeComplete from the sshContext, since it was not…
C0D3D3V Feb 8, 2025
1e822d4
Added option to reopen a SFTP channel in client mode if it was closed…
C0D3D3V Feb 8, 2025
505fd6c
Use old local channel ID, if reopening a channel.
C0D3D3V Feb 8, 2025
052c048
Print warning about ChannelCloseMessage only if we have not handled i…
C0D3D3V Feb 8, 2025
a6fc0c7
Merge remote-tracking branch 'origin/main' into daniel-main-merge
C0D3D3V Feb 8, 2025
fbdb6a7
Run formatter
C0D3D3V Feb 8, 2025
7b35bba
Use double dash for cli options and add some short names for the cli …
C0D3D3V Feb 13, 2025
5145ad3
update run configuration with new cli options
C0D3D3V Feb 13, 2025
ac42f37
refactor: Apply Java version migration aids
TrueSkrillor Feb 20, 2025
5447064
Merge remote-tracking branch 'origin/main' into daniel-main-merge
C0D3D3V Feb 21, 2025
2a3e997
Remove certificatePublicKeyData from HybridKeyExchangeInitMessage. Se…
C0D3D3V Feb 21, 2025
42f3a63
Merge remote-tracking branch 'origin/main' into daniel-main-merge
C0D3D3V Feb 21, 2025
2069dd2
run formatter
C0D3D3V Feb 21, 2025
ad576a2
Make it optional to treat timeout on receive as IO Exception. I intro…
C0D3D3V Feb 22, 2025
ce6012e
Fix TextSeek parsing. Fix logger of some handlers. Warn about unimple…
C0D3D3V Feb 24, 2025
3bcaf77
Move the four array converter methods to our converter. Because I do …
C0D3D3V Feb 24, 2025
d069905
Use getFirst instead of get(0)
C0D3D3V Feb 26, 2025
464ac6b
Remove all setSoftly methods. Set softly does not fit into the vision…
C0D3D3V Feb 26, 2025
bc0f0ce
Add LanguageTag Enum, so we have valid options for this field. And th…
C0D3D3V Feb 26, 2025
ce9e2b9
Fix resetUsingRefelctions()
C0D3D3V Feb 26, 2025
0e9fd3b
Move ModifiablePath into SSH-Attacker. Because it is not wanted insid…
C0D3D3V Feb 26, 2025
b364f62
Explicitly add Variable Modifications classes for serialization, beca…
C0D3D3V Feb 27, 2025
609a90f
org.Reflections is now a dependency because of the commit before.
C0D3D3V Feb 27, 2025
af9e2db
remove unused variable in test
C0D3D3V Feb 27, 2025
127859c
Add missing builder methods to ModifiablePath.
C0D3D3V Feb 27, 2025
0c2145a
Split SFTP v4 Messages out from SFTPv3 messages. This way the code is…
C0D3D3V Feb 27, 2025
1ee9cdc
See commit one before. Adds the SFTP v4 messages, I forgot to commit.
C0D3D3V Feb 27, 2025
f5368b0
Remove some unused variables
C0D3D3V Feb 27, 2025
7f83113
run formatter
C0D3D3V Feb 27, 2025
14157b3
remove todo
C0D3D3V Feb 27, 2025
6bc78ae
Add new XmlElement annotations
C0D3D3V Feb 27, 2025
31d20bb
A typo has crept in
C0D3D3V Feb 27, 2025
902b04a
Use setModifications instead of setModification. Because setModificat…
C0D3D3V Feb 28, 2025
1ff2dea
Handle malformed SFTP messages, sent by the other side, a little bit …
C0D3D3V Feb 28, 2025
561318b
Do not return empty unknown SFTP message, instead parse malformed mes…
C0D3D3V Feb 28, 2025
fcae97d
Make parsing errors a little bit more verbose.
C0D3D3V Feb 28, 2025
330f26b
Add comment about length field in Data packets
C0D3D3V Feb 28, 2025
62e12f3
Change comment to todo
C0D3D3V Feb 28, 2025
3b9ebc4
Use getSocketState() to actually check the socket state after receivi…
C0D3D3V Mar 2, 2025
dee8533
Print verbose parsing errors as warning only for implemented sftp ver…
C0D3D3V Mar 3, 2025
37a563c
Small fix for SftpV4FileAttributesParser
C0D3D3V Mar 3, 2025
05327e1
Add option to configure a specific handle from the maintained list, i…
C0D3D3V Mar 5, 2025
e85fda1
Add some simple constructors to messages with handle, so that configu…
C0D3D3V Mar 5, 2025
878f052
Fix the bug that crept into the last commit.(fixes getFileHandle)
C0D3D3V Mar 5, 2025
44b60eb
Make warning about data message parsing consume error more verbose.
C0D3D3V Mar 5, 2025
80cdee3
Add trace log message for Complete packet payload bytes
C0D3D3V Mar 5, 2025
05c2db9
Add comment about malformed filenames.
C0D3D3V Mar 5, 2025
ee8f213
Hardening SFTP Version exchange a little bit. Fallback to SFTPv3 Pars…
C0D3D3V Mar 5, 2025
f26b839
Check if the context is client, in adjustContextAfterMessageSent
C0D3D3V Mar 5, 2025
77fc67a
Revert fallback to SFTP v3 Parsing. It does not really make sense.
C0D3D3V Mar 5, 2025
2d223fd
Activate adjustContextAfterSent on the SFTP Handshake messages
C0D3D3V Mar 5, 2025
63cd24e
Make Negotiated SFTP version waring a debug message. Warn only about …
C0D3D3V Mar 5, 2025
9d6a41a
Make SFTP parsing errors debug, no matter what SFTP is negotiated. Ha…
C0D3D3V Mar 5, 2025
b213843
Simlify log message
C0D3D3V Mar 5, 2025
d36276a
Rename SftpFilePermission enums. Add Flags for file type.
C0D3D3V Mar 9, 2025
03a9751
Change default value of SftpRequestExpandPathMessage path.
C0D3D3V Mar 12, 2025
c95a41b
Simplify code of adjustContext and adjustContextAfterMessageSent of c…
C0D3D3V Mar 16, 2025
a8e715e
Use removeFirst
C0D3D3V Mar 16, 2025
e1244f1
Add ChannelRequestMessageHandler class, that I forgot to add to the c…
C0D3D3V Mar 16, 2025
fef2ef3
Use singleton for Data Packet parser
C0D3D3V Mar 16, 2025
4c59c5b
Rename some Sftp Extension Enums to match the pattern used before.
C0D3D3V Mar 17, 2025
bc12a1e
Fix typo: preperator -> preparator
C0D3D3V Mar 19, 2025
bafc054
Change visibility of preparator methods from public to protected. I s…
C0D3D3V Mar 22, 2025
8c1d166
fix some more visibilities
C0D3D3V Mar 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Refactor code to use lazy logging
ef9c3a141a76a9d86f1fbb8d1183d62b44c3c146
0ecd981eabda518bd1dcc5a5595186d64f6f8836
3d40f371eb823aa7463882eeedd71486d8959346
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ nbactions.xml
# VS Code
.factorypath
.vscode

### IntelliJ IDEA ###
.idea/*
!.idea/inspectionProfiles
!.idea/runConfigurations
*.iws
*.iml
*.ipr


32 changes: 15 additions & 17 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Client___KEX_only__DH_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Client___KEX_only__DH_GEX_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Client___KEX_only__Dynamic_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Client___KEX_only__ECDH_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Client___KEX_only__RSA_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ private static RSAPublicKey fetchRsaTransientKey(Config config, int attempt, int
} catch (IOException e) {
if (attempt < maxAttempts) {
LOGGER.debug(
String.format(
"Encountered IOException on socket in attempt %d, retrying...",
attempt));
"Encountered IOException on socket in attempt {}, retrying...", attempt);
return fetchRsaTransientKey(config, attempt + 1, maxAttempts);
} else {
LOGGER.warn("Could not fetch server's RSA host key, encountered IOException");
Expand All @@ -87,10 +85,7 @@ private static RSAPublicKey fetchRsaTransientKey(Config config, int attempt, int
.getPublicKey();
} else {
if (attempt < maxAttempts) {
LOGGER.debug(
String.format(
"Did not receive PubkeyMessage in attempt %d, retrying...",
attempt));
LOGGER.debug("Did not receive PubkeyMessage in attempt {}, retrying...", attempt);
return fetchRsaTransientKey(config, attempt + 1, maxAttempts);
} else {
LOGGER.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,9 @@ private RSAPublicKey getServerPublicKey() {
return null;
}
LOGGER.info(
String.format(
"Fetched server public key with exponent %s and modulus: %s",
publicKey.getPublicExponent().toString(16),
publicKey.getModulus().toString(16)));
"Fetched server public key with exponent {} and modulus: {}",
publicKey.getPublicExponent().toString(16),
publicKey.getModulus().toString(16));
return publicKey;
}

Expand Down Expand Up @@ -330,10 +329,9 @@ public void executeAttack() {
}

LOGGER.info(
String.format(
"Fetched server public key with exponent %s and modulus: %s",
publicKey.getPublicExponent().toString(16),
publicKey.getModulus().toString(16)));
"Fetched server public key with exponent {} and modulus: {}",
publicKey.getPublicExponent().toString(16),
publicKey.getModulus().toString(16));
byte[] encryptedSecret = ArrayConverter.hexStringToByteArray(config.getEncryptedSecret());
if (encryptedSecret.length * Byte.SIZE != publicKey.getModulus().bitLength()) {
throw new ConfigurationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Manger(byte[] msg, Pkcs1Oracle pkcsOracle) {
tmp = (MathHelper.intCeilDiv(tmp, 8) - 1) * 8;
bigB = BigInteger.ONE.shiftLeft(tmp);
c0 = new BigInteger(1, encryptedMsg);
LOGGER.debug("b: {}", ArrayConverter.bytesToHexString(bigB.toByteArray()));
LOGGER.debug("b: {}", () -> ArrayConverter.bytesToHexString(bigB.toByteArray()));
}

/**
Expand All @@ -66,7 +66,8 @@ public void attack() throws OracleException {
}

LOGGER.debug(
"Ciphertext after step 0: {}", ArrayConverter.bytesToHexString(c0.toByteArray()));
"Ciphertext after step 0: {}",
() -> ArrayConverter.bytesToHexString(c0.toByteArray()));

LOGGER.debug("Step 1");
BigInteger f1 = new BigInteger("2");
Expand Down Expand Up @@ -124,9 +125,10 @@ public void attack() throws OracleException {
}

if (!interrupted) {
BigInteger finalMmin = mmin;
LOGGER.debug(
"Manger's attack solution (before inverse computation, if any): {}",
ArrayConverter.bytesToHexString(mmin.toByteArray()));
() -> ArrayConverter.bytesToHexString(finalMmin.toByteArray()));

if (fx.equals(BigInteger.ONE)) {
solution = mmin;
Expand All @@ -136,7 +138,7 @@ public void attack() throws OracleException {
}
LOGGER.debug(
"Manger's attack solution (after inverse computation, if any): {}",
ArrayConverter.bytesToHexString(solution.toByteArray()));
() -> ArrayConverter.bytesToHexString(solution.toByteArray()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/
package de.rub.nds.sshattacker.attacks.pkcs1;

import de.rub.nds.modifiablevariable.bytearray.ByteArrayModificationFactory;
import de.rub.nds.modifiablevariable.bytearray.ModifiableByteArray;
import de.rub.nds.modifiablevariable.util.Modifiable;
import de.rub.nds.sshattacker.core.config.Config;
import de.rub.nds.sshattacker.core.constants.RunningModeType;
import de.rub.nds.sshattacker.core.protocol.transport.message.KeyExchangeInitMessage;
Expand Down Expand Up @@ -39,10 +38,7 @@ public static WorkflowTrace generateWorkflow(Config sshConfig, byte[] encryptedS
trace.addSshAction(
new ReceiveAction(new KeyExchangeInitMessage(), new RsaKeyExchangePubkeyMessage()));
RsaKeyExchangeSecretMessage secretMessage = new RsaKeyExchangeSecretMessage();
ModifiableByteArray encryptedSecretArray = new ModifiableByteArray();
encryptedSecretArray.setModification(
ByteArrayModificationFactory.explicitValue(encryptedSecret));
secretMessage.setEncryptedSecret(encryptedSecretArray, true);
secretMessage.setEncryptedSecret(Modifiable.explicit(encryptedSecret), true);
trace.addSshAction(new SendAction(secretMessage));
trace.addSshAction(new ReceiveAction());
return trace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static byte[] getSecretWrongFirstByte(
paddedSecret[0] = (byte) 1;
LOGGER.debug(
"Generated a PKCS1 padded message with a wrong first byte: {}",
ArrayConverter.bytesToHexString(paddedSecret));
() -> ArrayConverter.bytesToHexString(paddedSecret));
return paddedSecret;
}

Expand All @@ -178,7 +178,7 @@ private static byte[] getSecretWrongSecondByte(
paddedSecret[1] = (byte) (paddedSecret[1] ^ (byte) 255);
LOGGER.debug(
"Generated a PKCS1 padded message with a wrong second byte: {}",
ArrayConverter.bytesToHexString(paddedSecret));
() -> ArrayConverter.bytesToHexString(paddedSecret));
return paddedSecret;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static de.rub.nds.tlsattacker.util.ConsoleLogger.CONSOLE;

import de.rub.nds.modifiablevariable.util.ArrayConverter;
import de.rub.nds.sshattacker.core.util.Converter;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.security.MessageDigest;
Expand Down Expand Up @@ -166,7 +167,7 @@ public static byte[] mgf1(byte[] seed, int maskLen, String digestName)
for (int counter = 0; counter < maxIterations; counter++) {

// Step a: Convert counter using I2OSP
byte[] counterBytes = ArrayConverter.intToBytes(counter, 4);
byte[] counterBytes = Converter.intToFourBytes(counter);

// Step b: Concatenate hash of seed and counterBytes with intermediate result
ByteBuffer digestInputBuffer = ByteBuffer.allocate(seed.length + 4);
Expand Down Expand Up @@ -220,8 +221,10 @@ public static BigInteger decodeSolution(

byte[] result = doOaepDecoding(solutionBytes, hashInstance, publicKeyByteLength);

CONSOLE.debug("Secret with length field as byte array: {}", Arrays.toString(result));
CONSOLE.debug("Secret with length field: {}", new BigInteger(result));
CONSOLE.debug(
"Secret with length field as byte array: {}",
() -> ArrayConverter.bytesToRawHexString(result));
CONSOLE.debug("Secret with length field: {}", () -> new BigInteger(result));

// Cut off length field to get secret as decimal number
ByteBuffer secretBuffer = ByteBuffer.wrap(result);
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ SSH-Attacker uses the concept of Modifiable Variables to allow runtime modificat
```java
ModifiableInteger i = new ModifiableInteger();
i.setOriginalValue(30);
i.setModification(new AddModification(20));
i.addModification(new AddModification(20));
System.out.println(i.getValue()); // 50
```

Expand All @@ -172,7 +172,7 @@ We can of course use this concept by constructing our SSH workflows. Imagine you
ChannelOpenSessionMessage channelOpenSessionMessage = new ChannelOpenSessionMessage();
ModifiableInteger i = new ModifiableInteger();
channelOpenSessionMessage.setConfigSenderChannelId(1337);
i.setModification(new IntegerAddModification(100));
i.setModifications(new IntegerAddModification(100));
channelOpenSessionMessage.setSenderChannelId(i);//1437
```

Expand Down
Loading