Your strings are not safe!!!

Everything else that doesn't fall into one of the other PB categories.
KlintonWoo
User
User
Posts: 13
Joined: Wed Jun 02, 2004 10:10 am

Your strings are not safe!!!

Post by KlintonWoo »

I stumbled across a program called Textscan by AnalogX, which basically can read all the values, strings from your EXE's... a big problem for those creating near-simple security in their programs like registration keys etc...


http://www.analogx.com/contents/downloa ... xtscan.htm
A mind once stretched by a new idea, never regains its original dimensions.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

You have this problem with *every* program-language.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

thats why one of the most important rules of protecting valuable strings is
encrypting them. This is to be said for every programming language. so
PROTECT YOUR STRINGS! but only the valuable ones. and be ware of
using a word as password for unencrypting, that will be seen as well.
But i noticed that a lot of string finders wont notice your string and password,
if the encrypting makes a weird string out of it. non readable characters etc.
Low achii walues. And using 0 and 1 for password, most string listers wont
actually show it.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

--Kale

Image
KlintonWoo
User
User
Posts: 13
Joined: Wed Jun 02, 2004 10:10 am

Post by KlintonWoo »

I have seen those MD5 etc commands in the documentation, but i have no idea how to use them, my idea of encryption/cipher is entering a string or data, a keyword or password and take the output as the encrypted form.

If someone could tell me how, i would appreciate it :wink:
A mind once stretched by a new idea, never regains its original dimensions.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

you don't need programs to see the strings in the program just open it in notpad and look at the end ;)
~Dreglor
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Your strings are not safe!!!

Post by PB »

Compile this into an exe and take a look with a hex editor:

Code: Select all

a$=Chr('t')+Chr('h')+Chr('i')+Chr('s')+Chr(' ')
a$+Chr('i')+Chr('s')+Chr(' ')
a$+Chr('h')+Chr('i')+Chr('d')+Chr('d')+Chr('e')+Chr('n')+Chr(' ')
a$+Chr('i')+Chr('n')+Chr(' ')+Chr('a')+Chr('n')+Chr(' ')
a$+Chr('e')+Chr('x')+Chr('e')
MessageRequester("test",a$,0)
;)

WARNING: This is NOT recommended for important data! You should always
use encryption for important data, as mentioned in this topic already. But this
method is fine for non-vital things such as Easter Egg messages and so on.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Your strings are not safe!!!

Post by PB »

> I stumbled across a program called Textscan by AnalogX, which basically
> can read all the values, strings from your EXE's

A better app is BinText: http://tinyurl.com/4amuz

BinText is smaller, needs no installation, has filtering, and lets you maximize
the window to see more results. :) Highly recommended.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Here's an exampel using MD5 hashing to check passwords.

Code: Select all

Password.s = "Purebasic" 
MD5.s = MD5Fingerprint(@Password, Len(Password))
OpenConsole()
PrintN("Enter password or Q to quit")
finished = #False
Repeat
  Entered.s = Input()
  PrintN("")
  If LCase(Entered) = "q"
    finished = #True
  ElseIf MD5Fingerprint(@Entered, Len(Entered)) = MD5
    PrintN("Password is correct")
  Else
    PrintN("Incorrect Password")
  EndIf
Until finished
CloseConsole()
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

@GedB In your example you're still storing the password in a string. It's no more secure than not using the encryption at all. Open up your exe with a hex editor and you'll still find the password there, plain to see. I always thought the way to use those commands was like this (the password's still Purebasic)

Code: Select all

MD5.s="2747d19b44270f1e0e23bf32aca3a1f7"
OpenConsole() 
PrintN("Enter password or Q to quit") 
finished = #False 
Repeat 
  Entered.s = Input() 
  PrintN("") 
  If LCase(Entered) = "q" 
    finished = #True 
  ElseIf MD5Fingerprint(@Entered, Len(Entered)) = MD5 
    PrintN("Password is correct") 
  Else 
    PrintN("Incorrect Password") 
  EndIf 
Until finished 
CloseConsole() 
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

GreenGiant,

The example was to show how to use the functions. :roll:

Originally I did put a comment at the end of the first line that said ';Of course, you don't want to do this' but I took it off to avoid being patronising. :wink:
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

Ahhhh ok. Woops :oops:
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

To be honest, I didn't realise until after I'd posted it, and thought 'I really should have put a comment there.' :oops:

Didn't think anyone would notice. Next time I'll take the time to edit.
ivory
User
User
Posts: 36
Joined: Fri Jun 25, 2004 2:30 am

MD5 is ok for casual encryption

Post by ivory »

I think MD5 has been cracked and is not considered suitable for any serious encryption, but it is CERTAINLY suitable for turning your strings unrecognizable sections of code.
Post Reply