Timeouts

Amnesiac incorporates a timeout feature for user-defined commands executed through a session on the target system. This feature is designed to ensure a smoother user experience and prevent users from getting stuck in an unresponsive command prompt for an extended period.

Purpose of Timeouts

The timeout feature serves a crucial purpose: if a user-defined command executed on the target system hangs or runs indefinitely, the timeout mechanism intervenes. Rather than leaving the user stranded in a non-responsive state, Amnesiac automatically redirects them back to the main menu.

Timeout Duration

For user-defined commands, the timeout duration is set at 30 seconds. If a command exceeds this time limit, the user will be brought back to the main menu, allowing them to continue their session without being stuck.

Predefined Command Exceptions

Most predefined commands in Amnesiac also adhere to a 30-second timeout. However, there is one notable exception—the DCSync command. Given the potentially resource-intensive nature of this operation, the timeout for DCSync is extended to 5 minutes. This should allow sufficient time for the extraction of NTDS.dit file hashes, especially in the case of larger files.

Handling Timeout Situations

When the timeout is reached, the following scenarios can occur:

  • If the command is still running on the target, the user may have to wait for its completion before being able to re-enter the session. If the connection remains active, re-entering the session initiates a 5-second timeout before redirecting the user to the main menu. This behavior prevents potential issues caused by re-entering a session while a command is still running.

  • If the connection to the session is lost during a timeout, the user won't be able to re-enter the session. Any attempts to re-enter the session will result in an immediate redirection to the main menu. This feature is in place to maintain session integrity and prevent issues caused by re-entering an interrupted session.

Communication Synchronization and the "sync" Command

In some cases, if a user manages to re-enter a shell session after a timeout, it's possible that the synchronization between communication pipes is lost. This means that when a command is issued, the output received may not correspond to the expected response. Instead, it could be a result of a previous command issued before the timeout occurred.

To address this issue and re-establish synchronization in the communication process, Amnesiac includes the "sync" command. When you use the "sync" command within a session, it serves to refresh and align the communication pipes, ensuring that subsequent commands and their outputs are consistent and accurate.

However, it's essential to be aware that using the sync command has one significant consequence: any previous output resulting from commands issued before the timeout, and the sync command itself, will be lost. Therefore, users should exercise caution when using the "sync" command, as it effectively resets the communication synchronization and discards any previous command output.

Future Enhancements

Currently, there is no way to adjust or customize the timeout duration in Amnesiac. However, we are planning to implement this feature in future releases to provide users with more flexibility.

Managing Unresponsive Sessions

In the event that a session becomes unresponsive and cannot be entered or re-entered, users have two options:

  1. Leave the session as it is and attempt to access it at a later time when the command completes or the situation changes.

  2. If the session is no longer needed or is causing issues, users can choose to kill the session, which will remove it from the session list.

In summary, the timeout feature in Amnesiac is a safeguard to ensure a seamless and responsive user experience. While it helps prevent users from getting stuck in unresponsive sessions, it's important to be aware of how it operates and the scenarios it addresses.

Last updated