Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions Security.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@
#include <aclapi.h>
#include <bcrypt.h>


auto is_hooked = [](void* fn) -> bool {
if (!fn) return true;


BYTE bytes[5];
memcpy(bytes, fn, 5);


if (bytes[0] == 0xE9 || bytes[0] == 0xE8)
return true;

if (bytes[0] == 0xFF && bytes[1] == 0x25)
return true;

return false;
};


// code submitted in pull request from https://github.com/sbtoonz, authored by KeePassXC https://github.com/keepassxreboot/keepassxc/blob/dab7047113c4ad4ffead944d5c4ebfb648c1d0b0/src/core/Bootstrap.cpp#L121
inline bool LockMemAccess()
{
Expand Down
22 changes: 22 additions & 0 deletions auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,28 @@ std::string KeyAuth::api::req(const std::string& data, const std::string& url) {
signature.clear();
signatureTimestamp.clear();



if (is_hooked((void*)&curl_easy_perform))
{
error(XorStr("Hook detected in curl_easy_perform"));
}

if (is_hooked((void*)&curl_easy_init))
{
error(XorStr("Hook detected in curl_easy_init"));
}

if (is_hooked((void*)&curl_easy_setopt))
{
error(XorStr("Hook detected in curl_easy_setopt"));
}

if (is_hooked((void*)&curl_easy_cleanup))
{
error(XorStr("Hook detected in curl_easy_cleanup"));
}

CURL* curl = curl_easy_init();
if (!curl) {
error(XorStr("CURL Initialization Failed!"));
Expand Down