wc3edit.net

United Warcraft 3 map hacking!
It is currently April 27th, 2024, 9:55 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: May 28th, 2008, 7:57 pm 
Offline
Newcomer

Joined: May 28th, 2008, 1:56 am
Posts: 17
This is VERY EASY to reverse once you're aware of it. But it's interesting just the same.

Simply use this code somewhere in your game code (it shouldn't even ever have to be triggered to work):
Code:
call CreateQuestBJ(0,"Something Here... irrelevant", "REPLACE THIS", "ReplaceableTextures\\CommandButtons\\BTNHolyBolt.blp")

"REPLACE THIS" should be replaced by a string literal (not a variable). If the length (the number of characters) of this string literal exceeds 1023 (if it's 1024 characters long or longer) WC3 will crash whenever the map is selected (in the "create game" or "custom game" screens). NOTE: Although I have only tested this for the CreateQuestBJ function, it probably works the same way for most (if not all) functions.
(Why 1023 characters? Most likely because "0x00" or "\0" or NULL is appended automatically to any string thus making it 1024 or 2^10 "under the hood".)

The trick here lies in how line breaks can be represented in many different ways and that WC3 reliably understands at the very least two of these representations: CR (carriage return, 0x0D, used most prominently in Mac environments) and CR+LF (carriage return + line feed, 0x0D0A, used most prominently in Windows environments). As you can see, CR occupies only 1 byte (one character) while CR+LF is 2 bytes long (two characters), yet they do the exact same thing (within WC3). So, what does this give?

Since the vast majority of WC3 users and modders use Windows, their line breaks will be saved as CR+LF (per default). But what if we previously, in our war3map.j source file, used CR for our line breaks, what happens then? It depends, but most often the file editor will load the file correctly, but later when saving it CR+LF will be used to encode any line breaks. (JassCraft, for instance, works this way. And I dare say it's the most popular Jass editor out there.) So, how do we exploit this?

All we have to do to exploit the above weakness is to make sure our string literal is less than 1024 characters in length when saved using CR to represent our line breaks (btw Jass has no problem handling line breaks within string literals in the war3map.j source file, so there’s no need to use "\n" or anything like that), yet exceeds 1023 characters in length when CR+LF is used to encode any line breaks. Thus the string literal should contain at the very least one CR, preferably lots of them, and be at least (1024 - [Number of CRs]) characters long. Just try to make the actual text make sense, as to hide its real intent.

You may have to use a hex editor (or an optimizer with this functionality) to assert those line breaks become only CRs and not CR+LFs in the file. If done correctly, when your average cheater/modder tries to hack your map by extracting, modifying and reimporting the war3map.j, even though his code works like a charm, your code will cause the map to crash because he introduced errors in it without even knowing it just by saving your war3map.j.

Easy as pie!

~ Kris

edit: Essentially rewrote the entire thing to improve comprehension.


Last edited by krille on August 24th, 2008, 2:07 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: May 28th, 2008, 9:16 pm 
Offline
The Flying Cow!
User avatar

Joined: November 2nd, 2007, 10:34 pm
Posts: 2247
Location: Melbourne
Wtf.. That's confusing :?

_________________
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!


Top
 Profile  
 
PostPosted: May 28th, 2008, 11:33 pm 
Offline
Newcomer

Joined: May 28th, 2008, 1:56 am
Posts: 17
Ozzapoo wrote:
Wtf.. That's confusing :?
It is... "REPLACE THIS" should be something like "lalalalalalal
lalalalalala
lalalal
lalalalalalalala
lalalalal
lalalalalala"

And about 1023 characters long. The goal is to make it exceed 1024 characters when all Cr's (0x0D) turn into CrLf's (0x0D0A). A 1024 characters long or longer array of literals as the argument to this function (most likely to many other functions as well) will crash TFT. Why? I don't know. Poor programming? Bug introduced by optimizations? I really don't know.

Why do this? To confuse newbies (like myself) and prevent them from cheating your map, mainly. Observant users will notice this difference simply by comparing the original with the saved version in a hex editor.

What exactly is it that you don't understand? :D


Top
 Profile  
 
PostPosted: May 29th, 2008, 12:09 am 
Offline
The Flying Cow!
User avatar

Joined: November 2nd, 2007, 10:34 pm
Posts: 2247
Location: Melbourne
How is that 1023 characters?

_________________
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!


Top
 Profile  
 
PostPosted: May 29th, 2008, 12:14 am 
Offline
Forum Drunk
User avatar

Joined: January 17th, 2007, 4:22 pm
Posts: 2903
Location: Darmstadt, Germany
Uhh nice find!
Linux, Mac and Windows have several ways to define a line break,
he does it the Linux way (maybe I'm wrong and it's the mac way... ask Wiki ;) )
A Windows editor will convert it to the Windows linebreak (from 1 to 2 byte) so it'll grow and crash :D

greets Dekar

ps:
just had a look at wiki... it's the mac way!
Quote:
* LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, etc.), BeOS, Amiga, RISC OS, and others
* CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows
* CR: Commodore machines, Apple II family, Mac OS up to version 9 and OS-9

_________________
Don't pm me with Warcraft questions, this is a forum so just make a post!

In the world of thinking we are all immigrants. -Robert Nozick


Top
 Profile  
 
PostPosted: May 29th, 2008, 7:33 am 
Offline
The Flying Cow!
User avatar

Joined: November 2nd, 2007, 10:34 pm
Posts: 2247
Location: Melbourne
I see.... :?

_________________
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!


Top
 Profile  
 
PostPosted: May 29th, 2008, 10:24 am 
Offline
Forum Staff
User avatar

Joined: October 21st, 2007, 6:17 am
Posts: 932
Location: WorLd Of WaRcrAfT
Title: 11
Thx for sharing this:D

_________________
~Everything changes~
I have met people who have no dreams, who have simply accepted their fate to work, exist, and die. They are the most miserable people I have ever known.


Top
 Profile  
 
PostPosted: May 30th, 2008, 8:05 am 
Offline
The Flying Cow!
User avatar

Joined: November 2nd, 2007, 10:34 pm
Posts: 2247
Location: Melbourne
Hm... So what editor do we use to make sure it's 1023 chars long :??

_________________
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!


Top
 Profile  
 
PostPosted: May 30th, 2008, 2:01 pm 
Offline
Newcomer

Joined: May 28th, 2008, 1:56 am
Posts: 17
Ozzapoo wrote:
Hm... So what editor do we use to make sure it's 1023 chars long :??
I use a hex editor to make sure there are only Cr's and not CrLf's in that particular string of the war3map.j. If there are CrLf's, use space or something instead and manually change it using a hex editor to Cr. I think WarCraft's native Map Editor makes it only Cr by default, either that or an Optimizer should do it.

Shamanno wrote:
Thx for sharing this:D
np. I'm all against the corruption or "protection" of maps anyway. I want things to be as well-documented as possible, so I share in the hope that others will do the same. (Although I know certain people won't and wouldn't even share this.)


Top
 Profile  
 
PostPosted: August 21st, 2008, 7:59 am 
Offline
Newcomer

Joined: August 21st, 2008, 7:58 am
Posts: 4
Hey if after adding the code, the map was optimized in any way, would it screw this protection up, or is it best to add it in AFTER the optimization?


Also as a side note: is widgetizer ment to be used BEFORE vex's opt? and if we're planning to use both, do settings need to change in either programs?
P.S: I'm not a noob, just haven't used the widgetizer before :P


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)