AutoHotkey Community

It is currently May 27th, 2012, 4:15 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: February 18th, 2010, 1:45 am 
Offline

Joined: August 12th, 2009, 6:07 pm
Posts: 26
Upon launching, my program runs the below...

Code:

FileDelete %A_programfiles%\config.txt
URLDownloadToFile,http://..../config.txt, c:\Program Files\config.txt
FileRead,validate,%A_programfiles%\config.txt

ifnotinstring, validate, validationstring
{   
FileDelete %A_programfiles%\config.txt
exitapp
}


I am trying to think of any way someone could continue to run the program if the downloaded text file does not contain the specified validation string. Any thoughts on if this is possible, or a way to get around the above procedure?

Thanks!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2010, 1:49 am 
if the user knows the website (from virus scanner or something), they would know the content, and then they can redirect the page to somewhere else or just create the text file by themselves


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2010, 1:54 am 
Offline

Joined: August 12th, 2009, 6:07 pm
Posts: 26
except the file is deleted both before and after the urldownload command, so the program would have to be suspended somehow after the download for them to change the contents of the text file.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2010, 5:17 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
If the program downloaded a file doesn't have the matching string, they can't run the program.

Of course, if they can de-compile your program and get the validation code, then they can run the program at will.

If they previously ran the program and the program downloaded a file _does_ have the matching string, they could copy that file and save it for future use. The snippet of code you posted does not show the file deleted if there is a match.

If the match is not based on a ever-changing validate, it would seem easy to duplicate the required file, or even to write-protect the file to prevent it being deleted.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2010, 11:38 pm 
Offline

Joined: August 12th, 2009, 6:07 pm
Posts: 26
Leef_me wrote:
If the program downloaded a file doesn't have the matching string, they can't run the program.

Of course, if they can de-compile your program and get the validation code, then they can run the program at will.

If they previously ran the program and the program downloaded a file _does_ have the matching string, they could copy that file and save it for future use. The snippet of code you posted does not show the file deleted if there is a match.

If the match is not based on a ever-changing validate, it would seem easy to duplicate the required file, or even to write-protect the file to prevent it being deleted.


Thanks! I forgot to include my file delete command following the ifnotinstring statement in the code above, so it does delete it regardless of outcome.

Regardless of this though, I still don't see how they could utilize a saved copy of the file since it is still deleted prior to the download.

Quote:
or even to write-protect the file to prevent it being deleted


This I can see as a potential way of getting around my above code. Perhaps I could do this then...

Code:
FileDelete %A_programfiles%\config.txt

IfExist, %A_programfiles%\config.txt
exitapp

URLDownloadToFile,http://..../config.txt, c:\Program Files\config.txt
FileRead,validate,%A_programfiles%\config.txt

ifnotinstring, validate, validationstring
{   
FileDelete %A_programfiles%\config.txt
exitapp
}

FileDelete %A_programfiles%\config.txt


Or, perhaps add a random function to the file name.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: rbrtryn and 67 guests


You can post new topics in this forum
You can 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:
Powered by phpBB® Forum Software © phpBB Group