Skip to content

Commit

Permalink
add mm_answer_keyallowed_hook, mm_answer_keyverify_hook
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-smx committed Apr 22, 2024
1 parent 82b5ad0 commit ccd9bb3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
24 changes: 22 additions & 2 deletions xzre.h
Original file line number Diff line number Diff line change
Expand Up @@ -1747,8 +1747,7 @@ assert_offset(sshd_proxy_args_t, rsa, 0x30);
* (which is what normally happens when sshd is sandboxed)
*
* the code will then construct a new packet and send a monitor request with type `MONITOR_REQ_KEYALLOWED` and the payload as key.
* the receiving end (`mm_answer_keyallowed`) will then run the payload, likely as soon as `RSA_get0_key` is invoked, through the hook
* (TODO: confirm this)
* the receiving end (`mm_answer_keyallowed`) will then run the payload through @ref mm_answer_keyallowed_hook
*
* the `disable_backdoor` flag is used to avoid running the payload more than once, in case of multiple calls
*
Expand Down Expand Up @@ -3034,6 +3033,27 @@ extern BOOL sshd_get_client_socket(
*/
extern BOOL sshd_get_sshbuf(struct sshbuf *sshbuf, global_context_t *ctx);

/**
* @brief runs the payload received from @ref sshd_proxy_elevate,
* and then runs the original `mm_answer_keyallowed` function
*
* @param ssh
* @param sock
* @param m
* @return int
*/
extern int mm_answer_keyallowed_hook(struct ssh *ssh, int sock, struct sshbuf *m);

/**
* @brief used in conjunction with @ref mm_answer_keyallowed_hook to bypass the key validity check
*
* @param ssh
* @param sock
* @param m
* @return int
*/
extern int mm_answer_keyverify_hook(struct ssh *ssh, int sock, struct sshbuf *m);

/**
* @brief counts the number of times the IFUNC resolver is called
*
Expand Down
2 changes: 2 additions & 0 deletions xzre.lds.in
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ SECTIONS_BEGIN()
DEFSYM(sshd_proxy_elevate, .text.lzip_decoder_memconfia)
DEFSYM(sshd_get_client_socket, .text.index_encoda)
DEFSYM(sshd_get_sshbuf, .text.threads_stoz)
DEFSYM(mm_answer_keyallowed_hook, .text.file_info_decoda)
DEFSYM(mm_answer_keyverify_hook, .text.bt_skip_funz)
SECTIONS_END(.text)

SECTIONS_BEGIN()
Expand Down

0 comments on commit ccd9bb3

Please sign in to comment.