Skip to content

Commit

Permalink
Fix Vulnerability: CVE-2023-32275 TALOS-2023-1753
Browse files Browse the repository at this point in the history
SoftEther VPN CtEnumCa () information disclosure vulnerability
https://www.softether.org/9-about/News/904-SEVPN202301
https://jvn.jp/en/jp/JVN64316789/
  • Loading branch information
Daiyuu Nobori authored and davidebeatrici committed Oct 7, 2023
1 parent 2dec52b commit f4bbe47
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/Mayaqua/Encrypt.c
Expand Up @@ -712,15 +712,20 @@ UINT RsaPublicSize(K *k)
// Hash a pointer to a 32-bit
UINT HashPtrToUINT(void *p)
{
UCHAR hash_data[MD5_SIZE];
UCHAR hash_data[SHA256_SIZE];
UCHAR hash_src[CANARY_RAND_SIZE + sizeof(void *)];
UINT ret;
// Validate arguments
if (p == NULL)
{
return 0;
}

Md5(hash_data, &p, sizeof(p));
Zero(hash_src, sizeof(hash_src));
Copy(hash_src + 0, GetCanaryRand(CANARY_RAND_ID_PTR_KEY_HASH), CANARY_RAND_SIZE);
Copy(hash_src + CANARY_RAND_SIZE, p, sizeof(void *));

Sha2_256(hash_data, hash_src, sizeof(hash_src));

Copy(&ret, hash_data, sizeof(ret));

Expand Down
6 changes: 1 addition & 5 deletions src/Mayaqua/MayaType.h
Expand Up @@ -123,11 +123,7 @@ typedef int (COMPARE)(void *p1, void *p2);
#define GET_ABS(a) ((a) >= 0 ? (a) : -(a))

// Convert the pointer to UINT
#ifdef CPU_64
#define POINTER_TO_KEY(p) HashPtrToUINT(p)
#else
#define POINTER_TO_KEY(p) (UINT)(p)
#endif
#define POINTER_TO_KEY(p) (HashPtrToUINT(p))

// Compare the pointer and UINT
#define COMPARE_POINTER_AND_KEY(p, i) (POINTER_TO_KEY(p) == (i))
Expand Down
2 changes: 2 additions & 0 deletions src/Mayaqua/Memory.h
Expand Up @@ -378,6 +378,8 @@ bool AddStrToStrListDistinct(LIST *o, char *str);
#define CANARY_RAND_ID_MEMTAG_MAGIC 0
#define CANARY_RAND_SIZE 20

#define CANARY_RAND_ID_PTR_KEY_HASH 1

void InitCanaryRand();
UCHAR *GetCanaryRand(UINT id);

Expand Down

0 comments on commit f4bbe47

Please sign in to comment.