Skip to content

Commit 0aaac9b

Browse files
committed
security: enforce response signature verification in req() and harden hook detection
1 parent 79d0b9c commit 0aaac9b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

auth.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static bool suspicious_modules_present()
287287
{
288288
const std::vector<std::string> bad = {
289289
"fiddlercore", "mitm", "charles", "httpdebugger", "proxifier",
290-
"detours"
290+
"detours", "minhook", "easyhook", "polyhook", "bypass", "inject", "hook"
291291
};
292292
HMODULE mods[1024];
293293
DWORD needed = 0;
@@ -3561,6 +3561,14 @@ std::string KeyAuth::api::req(std::string data, const std::string& url) {
35613561
error(XorStr("missing signature headers."));
35623562
}
35633563

3564+
// Enforce cryptographic payload verification on every request path.
3565+
const int verify_result = VerifyPayload(signature, signatureTimestamp, to_return);
3566+
if ((verify_result & 0xFFFF) != ((42 ^ 0xA5A5) & 0xFFFF)) {
3567+
if (req_headers) curl_slist_free_all(req_headers);
3568+
curl_easy_cleanup(curl);
3569+
error(XorStr("payload verification marker mismatch."));
3570+
}
3571+
35643572
char* effective_url = nullptr;
35653573
if (curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url) == CURLE_OK && effective_url) {
35663574
if (!is_https_url(effective_url)) {

0 commit comments

Comments
 (0)