Skip to content

Commit f5fce1a

Browse files
committed
update
1 parent c766094 commit f5fce1a

File tree

3 files changed

+335
-307
lines changed

3 files changed

+335
-307
lines changed

_posts/2025-06-22-02.md

Lines changed: 0 additions & 307 deletions
Original file line numberDiff line numberDiff line change
@@ -117,310 +117,3 @@ The changed example is shown below:
117117

118118
---
119119

120-
# Precautions
121-
122-
Code obfuscation tools cannot accurately understand all contexts. Therefore, users must protect their code by being alert to dangerous situations.
123-
When using code obfuscation and virtualization, be mindful of the following situations.
124-
125-
## Compiler Optimization Considerations
126-
If you're using the VxLang SDK to obfuscate or virtualize your code, ensure that you check the compiler optimization settings. When compiler optimization is enabled, your code might be merged in ways that differ from how you originally wrote it. If VxLang SDK functions are referenced within this merged code, the Begin/End positions might change, resulting in less obfuscation than intended.
127-
128-
- Here's how to fix the problem:
129-
- Turn off compiler optimization.
130-
- Disable code optimization for specific functions or pages at the code level.
131-
```cpp
132-
#pragma optimize("", off) /// turn off optimization ..
133-
void ObfuscationTest() {
134-
VL_OBFUSCATION_BEGIN;
135-
136-
// ...
137-
138-
VL_OBFUSCATION_END;
139-
140-
return;
141-
}
142-
```
143-
- Use MAP/PDB-based obfuscation/virtualization.
144-
- It is described in the next chapter.
145-
146-
## Potential Code Generation
147-
148-
Be aware of the following code pattern that may occur during the obfuscation and virtualization process:
149-
- In this example, the jmp rax instruction causes a jump from the VxLang region back to the original code. This type of code can occur when table-based operations are used in a switch-case statement.
150-
151-
```asm
152-
...
153-
call _VXLANG_BEGIN
154-
jmp L1
155-
156-
L0:
157-
jmp EXIT
158-
159-
L1:
160-
lea rax, $L0
161-
jmp rax
162-
163-
EXIT:
164-
call _VXLANG_END
165-
...
166-
```
167-
168-
Here's how to get around this:
169-
- [Link](https://github.com/vxlang/vxlang-page/blob/main/src/Example/01/tutorial/switchcase.cpp)
170-
171-
```cpp
172-
/*
173-
For switch-case statements, it is very dangerous to obfuscate the entire syntax.
174-
When compiled, it is moved to an unknown location (jmp reg), as shown below, and the obfuscation tool interprets it as it is,
175-
so the code is moved to the original location where it was erased.
176-
177-
*** Therefore, for switch-case statements, it is safe to obfuscate the case internals as shown in the sample.
178-
*/
179-
180-
181-
/*
182-
sub rsp,28
183-
dec ecx
184-
cmp ecx,E
185-
ja tutorial64.vxm.7FF6E9C4133F
186-
;
187-
movsxd rax,ecx
188-
lea rdx,qword ptr ds:[7FF6E9C40000]
189-
mov ecx,dword ptr ds:[rdx+rax*4+3710]
190-
add rcx,rdx
191-
jmp rcx ; ***** Danger code ..
192-
;
193-
lea rdx,qword ptr ds:[<"Case 1"...>]
194-
jmp tutorial64.vxm.7FF6E9C41346
195-
lea rdx,qword ptr ds:[<"Case 2"...>]
196-
jmp tutorial64.vxm.7FF6E9C41346
197-
lea rdx,qword ptr ds:[<"Case 3"...>]
198-
jmp tutorial64.vxm.7FF6E9C41346
199-
lea rdx,qword ptr ds:[<"Case 4"...>]
200-
jmp tutorial64.vxm.7FF6E9C41346
201-
lea rdx,qword ptr ds:[<"Case 5"...>]
202-
jmp tutorial64.vxm.7FF6E9C41346
203-
lea rdx,qword ptr ds:[<"Case 6"...>]
204-
jmp tutorial64.vxm.7FF6E9C41346
205-
lea rdx,qword ptr ds:[<"Case 7"...>]
206-
jmp tutorial64.vxm.7FF6E9C41346
207-
lea rdx,qword ptr ds:[<"Case 8"...>]
208-
jmp tutorial64.vxm.7FF6E9C41346
209-
lea rdx,qword ptr ds:[<"Case 9"...>]
210-
jmp tutorial64.vxm.7FF6E9C41346
211-
lea rdx,qword ptr ds:[<"Case 10"...>]
212-
jmp tutorial64.vxm.7FF6E9C41346
213-
lea rdx,qword ptr ds:[<"Case 11"...>]
214-
jmp tutorial64.vxm.7FF6E9C41346
215-
lea rdx,qword ptr ds:[<"Case 12"...>]
216-
jmp tutorial64.vxm.7FF6E9C41346
217-
lea rdx,qword ptr ds:[<"Case 13"...>]
218-
jmp tutorial64.vxm.7FF6E9C41346
219-
lea rdx,qword ptr ds:[<"Case 14"...>]
220-
jmp tutorial64.vxm.7FF6E9C41346
221-
lea rdx,qword ptr ds:[<"Case 15"...>]
222-
jmp tutorial64.vxm.7FF6E9C41346
223-
lea rdx,qword ptr ds:[<"Default case"...>]
224-
mov rcx,qword ptr ds:[<class std::basic_ostream<char, struct std::char_traits<char>> std::cout>]
225-
call <tutorial64.vxm.class std::basic_ostream<char, struct std::char_traits<char>> & __cdecl std::operator<<<struct std::char_traits<char>>(class std::basic_ostream<char, struct std::char_traits<char>> &, char const *)>
226-
lea rdx,qword ptr ds:[<class std::basic_ostream<char, struct std::char_traits<char>> & __cdecl std::endl<char, struct std::char_traits<char>>(class std::basic_ostream<char, struct std::char_traits<char>> &)>]
227-
mov rcx,rax
228-
add rsp,28
229-
jmp qword ptr ds:[<public: class std::basic_ostream<char, struct std::char_traits<char>> & __cdecl std::basic_ostream<char, struct std::char_traits<char>>::operator<<(class std::basic_ostream<char, struct std::char_traits<char>> & (__cdecl *)(class std::basic_ostream<char, >]
230-
*/
231-
232-
#pragma optimize("", off)
233-
void Warning_SwitchCaseTest(int value) {
234-
switch (value) {
235-
case 1:
236-
VL_VIRTUALIZATION_BEGIN;
237-
238-
std::cout << " Case 1" << std::endl;
239-
240-
VL_VIRTUALIZATION_END;
241-
break;
242-
case 2:
243-
VL_VIRTUALIZATION_BEGIN;
244-
245-
std::cout << " Case 2" << std::endl;
246-
247-
VL_VIRTUALIZATION_END;
248-
break;
249-
case 3:
250-
VL_VIRTUALIZATION_BEGIN;
251-
252-
std::cout << " Case 3" << std::endl;
253-
254-
VL_VIRTUALIZATION_END;
255-
break;
256-
case 4:
257-
VL_VIRTUALIZATION_BEGIN;
258-
259-
std::cout << " Case 4" << std::endl;
260-
261-
VL_VIRTUALIZATION_END;
262-
break;
263-
case 5:
264-
VL_VIRTUALIZATION_BEGIN;
265-
266-
std::cout << " Case 5" << std::endl;
267-
268-
VL_VIRTUALIZATION_END;
269-
break;
270-
case 6:
271-
VL_VIRTUALIZATION_BEGIN;
272-
273-
std::cout << " Case 6" << std::endl;
274-
275-
VL_VIRTUALIZATION_END;
276-
break;
277-
case 7:
278-
VL_VIRTUALIZATION_BEGIN;
279-
280-
std::cout << " Case 7" << std::endl;
281-
282-
VL_VIRTUALIZATION_END;
283-
break;
284-
case 8:
285-
VL_VIRTUALIZATION_BEGIN;
286-
287-
std::cout << " Case 8" << std::endl;
288-
289-
VL_VIRTUALIZATION_END;
290-
break;
291-
case 9:
292-
VL_VIRTUALIZATION_BEGIN;
293-
294-
std::cout << " Case 9" << std::endl;
295-
296-
VL_VIRTUALIZATION_END;
297-
break;
298-
case 10:
299-
VL_VIRTUALIZATION_BEGIN;
300-
301-
std::cout << " Case 10" << std::endl;
302-
303-
VL_VIRTUALIZATION_END;
304-
break;
305-
case 11:
306-
VL_VIRTUALIZATION_BEGIN;
307-
308-
std::cout << " Case 11" << std::endl;
309-
310-
VL_VIRTUALIZATION_END;
311-
break;
312-
case 12:
313-
VL_VIRTUALIZATION_BEGIN;
314-
315-
std::cout << " Case 12" << std::endl;
316-
317-
VL_VIRTUALIZATION_END;
318-
break;
319-
case 13:
320-
VL_VIRTUALIZATION_BEGIN;
321-
322-
std::cout << " Case 13" << std::endl;
323-
324-
VL_VIRTUALIZATION_END;
325-
break;
326-
case 14:
327-
VL_VIRTUALIZATION_BEGIN;
328-
329-
std::cout << " Case 14" << std::endl;
330-
331-
VL_VIRTUALIZATION_END;
332-
break;
333-
case 15:
334-
VL_VIRTUALIZATION_BEGIN;
335-
336-
std::cout << " Case 15" << std::endl;
337-
338-
VL_VIRTUALIZATION_END;
339-
break;
340-
default:
341-
VL_VIRTUALIZATION_BEGIN;
342-
343-
std::cout << " Default" << std::endl;
344-
345-
VL_VIRTUALIZATION_END;
346-
break;
347-
}
348-
349-
return;
350-
}
351-
352-
#pragma optimize("", off)
353-
void SwitchCaseTest() {
354-
VL_VIRTUALIZATION_BEGIN;
355-
356-
for (int i = 0; i < 16; ++i) {
357-
Warning_SwitchCaseTest(i);
358-
}
359-
360-
VL_VIRTUALIZATION_END;
361-
362-
return;
363-
}
364-
```
365-
366-
367-
## Exception Handling
368-
369-
VxLang currently only supports SEH (Structured Exception Handling). Therefore, be cautious when using it in conjunction with try-catch blocks.
370-
- As of version `2.1.6.1`, ***MSVC C++ exception handling*** has been added, but please be aware that the context is unstable.
371-
- This is explained in the next chapter.
372-
373-
```cpp
374-
#pragma optimize("", off)
375-
void ObfuscationSEHTest() {
376-
VL_OBFUSCATION_BEGIN;
377-
378-
__try {
379-
printf("SEH Test \n");
380-
__debugbreak();
381-
}
382-
__except (1) {
383-
printf(" Except \n");
384-
}
385-
386-
VL_OBFUSCATION_END;
387-
388-
return;
389-
}
390-
```
391-
392-
## Avoiding C++ exception handlers
393-
394-
SEH works with Windows system specifications. C++ EH, on the other hand, depends on the compiler specification (e.g. MSVC/Clang/GCC/Etc.), which can be circumvented by using the SDK as described below.
395-
396-
1. Unlike SEH, Catch syntax in C++ is represented as a separate function, so we apply the SDK separately as shown below.
397-
2. In addition, the C++ EH records where exceptions can be thrown.
398-
For this reason, code that can throw exceptions must be excluded from SDK sections.
399-
400-
```cpp
401-
#pragma optimize("", off)
402-
void test() {
403-
try {
404-
VL_OBFUSCATION_BEGIN;
405-
406-
printf(" > ObfuscationCxxEHTest \n");
407-
408-
VL_OBFUSCATION_END;
409-
410-
// *** Raise Exception
411-
throw std::runtime_error("Something went wrong - 1");
412-
}
413-
catch (...) {
414-
VL_OBFUSCATION_BEGIN;
415-
416-
printf(" > ObfuscationCxxEHTest Catch .. \n");
417-
418-
VL_OBFUSCATION_END;
419-
}
420-
421-
return;
422-
}
423-
```
424-
425-
---
426-

_posts/2025-07-31-01.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: How to Obfuscate with PDB and MAP
3+
author: VxLang
4+
date: 2025-07-31
5+
category: Jekyll
6+
layout: post
7+
---
8+
9+
---
10+
11+
# Create a project file using Obscurion
12+
13+
Obscurion is a tool that helps user create binary own project files via `PDB` or `MAP` files.
14+
15+
...
16+
17+
---
18+

0 commit comments

Comments
 (0)