Not logged inRybka Chess Community Forum
Up Topic Rybka Support & Discussion / Rybka Discussion / How secure is the source code of Rybka?
- - By SR (****) Date 2007-06-05 19:30
Maybe I am paranoid, but since each computer running rybka in fact are running the machine code that was produced from the source code of rybka, is it not possible to reconstruct the source code of rybka from the machine code?

To secure the source code it might be possible to add dummy code to the machine code, in such a fashion that attempts to "lift" the program are doomed. Well, maybe this is already done or maybe some other security measure is in place?! If not I will happy to try to investigate (I am a computer scientist) ways to secure the source code in programs like Rybka.
Parent - - By Michael Waesch Date 2007-06-05 21:15
Sure one can decompile machine code. This will not be very readable, but it´s possible. And if I remember it correct, Vasik once said that he thinks that any sort of copy-protection would be an everyone´s waste of time.

Mike
Parent - By noctiferus (***) Date 2007-06-05 21:27
You remember correct , I too remember  Vas'statement. It was long time ago, when he was  releasing 1.0 something, or 1.1
Parent - - By Uri Blass (*****) Date 2007-06-05 21:39
I think that writing a program that is better than rybka is clearly an easier task than understanding the rybka's code from the machine code.

In theory  it is not impossible to reconstruct the source of rybka from the machine code but I see no reason to do it because a person who is smart enough to do it can probably write something better than rybka without doing it.

I think that even understanding micromax that is free source code based only on the C code and not based on comments is an hard task and understanding rybka's code from the machine code is significantly harder.

Uri
Parent - By diepchess (*) Date 2009-11-22 22:18
Many people speak Chinese. If you cannot, it would be wiser to say that designing Chinese writing is tougher than learning a text is in chinese for those who speak chinese.

Vincent
Parent - - By InspectorGadget (*****) Date 2009-11-23 07:56

> I think that writing a program that is better than rybka is clearly an easier task than understanding the rybka's code from the machine code.
>


After the whole "The Thing" saga it is interesting to read this coming from a chess programmer. Wow! this is from way back 2007 :)
Parent - By Uri Blass (*****) Date 2009-11-23 08:05
Note that I read that today there are better tools to help translating exe file to C so I guess that the cloners do not need to understand rybka's code directly from the machine code.
I still think that without name of variables the task is not easy.

Uri
Parent - - By Silvian (***) Date 2007-06-06 07:49 Edited 2007-06-06 08:15
Hi !
Be sure you are paranoid ! Rybka is just a computer chess program and chess is only a game not a nuclear weapon !
Better for you the source code of Rybka to be closed at Fort Knox ???????????
Another source code of a strong chess engine-Strelka in fact- was raped at the demand of a great part of computer chess community with a real pleasure !

Have a nice day !
Silvian

NB: Rybka is running on around 3,000 computers. Too much ?
Parent - By diepchess (*) Date 2009-11-22 22:20
For international standards read them at:

www.wassenaar.org

Signed by nearly all nations. Initiator of it was USA by the way.

About every algorithm in computerchess and in computer games in general, especially protection of it,
it falls soon under category 5 which is a similar category like weapons of mass destruction such as nukes.

You don't hear me say that i like that, or that it practical has any consequences, but it's the paper reality.

Vincent

p.s. Wassenaar is the city name in Netherlands where the new US embassy is located for example, it's next to The Hague.
Parent - - By grolich (***) Date 2007-06-06 08:43
As I used to do quite a bit of reverse engineering myself in the past, I can only say this:

Your main issue is that ANY protection you try will at best just delay the success of any good reverse engineer. If he's anything more than average, the delay will only be of a few days at most.

In Rybka's case, it will have the opposite effect, as it will only convince people who were not interested in Rybka before to become interested in the protection scheme itself and therefore actually entice people to unmask the code itself (trust me when I say, my past experiences in this field have shown me that the world is full of people who are just waiting for a challenge like this, and who are more than capable of pulling it off).

Still, I don't think that would ever be a problem, EVEN if it does happen. Here's why:
tackling certain pieces of assembly code which are responsible for a specific action is relatively easy.

However, tackling a full blown monster of an evaluation function, with all the logic you have to uncover is prohibitively difficult.
It's easy to find the parts of the code responsible for the evaluation, given sufficient time, but understanding the evaluation function from assembly is close to impossible.

As for just grabbing the instructions you suspect are the ones belonging to the evaluation... What is that good for? just dropping them somewhere else is a bad idea. The different parts of any optimized code are too dependent on one another... It won't work.

Ok, after explaining why there's absolutely no reason to be paranoid here,
I'll just add this:

There have been countless code protection schemes over the years. People from all over the world created seemingly very sophisticated techniques (everything from bogus code, self modifying code, "practically unbreakable" encryption schemes, detection of debuggers running in memory and refusing to run alongside them and a ton of other approaches).
By the way: your suggested addition of bogus code is by far one of the easiest to detect.

they NEVER work. No protection scheme even survives for long before someone finds a way to bypass it. After that the only purpose it serves is to make some more money for the guy who wrote it... Because many companies just need, as a policy, a proection scheme on each product
(If your main goal is just to delay the issue, for SOME programs it can be a good idea).
And even that money making machine dwindles to nothingness after a while.

You may think you can do better than the countless attempts that have been made before.
But I am sure you will fail. This is completely unrelated to how good and / or smart you are.

It's just that it all boils down to a simple truth:
EVERYTHING you write, every bogus code, encryption, or whatever, will HAVE to be loaded in memory
and run on the machine at some point, as the actual, real code.

At that point any debugger running on the machine can easily show the necessary code (oh yeah, I forgot, each debugger detection technique is eventually bypassed as well).
If you put extra protection before the code, the protection will show on the debugger.

And yes, the people doing this are good enough to use their debuggers effectively enough to find these things rather quickly.
the whole code protection issue is a big nonsense.

So, stop with the paranoia and just start enjoying this great program called Rybka.
Parent - - By SR (****) Date 2007-06-06 09:49
I certainly enjoy Rybka. Maybe the discussion of protecting Rybkas source code is a bit academic, since I suppose a more realistic way of "lifting" the program is to just to use the raw machinecode as a subroutine in a clone between different programs. I think it is possible to guard agaist cloning, however it require that rybka deliberately return bogus evaluations (on the output level) on a few rare positions (say 1 in 10000 positions). If the evaluation is bogus the correct evalution pops up as a drawing (that is virtually impossible to read automatically). The bogus evaluations does not affect the playing strength of Rybka since they only concerns the output. This will to extend make it much harder to use Rybkas output in clone.  To be really effcient one would need to have make deliberate mistakes (with a low probability) in certain unnatural positions. If done cleverly these (rare) mistakes will not affect the strengh of Rybka (and will never confuse the user), however the clone that use Rybka as a subroutine with grossly confused by all the "attractive" bogus evaluations and mistaken moves.

To have Rybka make deliberate bad moves and evaluations in rare positions might sound absurd, but I think that it could be done so it would never confuse the human (who use Rybka for analyis), would hardly affect Rybkas playing strength, but would render it virtually impossible to clone Rybka. The very rare deliberately bad moves (that only occor on the outlevel) will dramatically disturb any program that calls Rybka as subroutine millions of times.

Well, I agree that it is probably absurd to go to such length to protect against stealing the source code as well as cloning. However I am sure it can done.
A practial way might be to have Rybka play perfect (no deliberate mistakes) on the Rybka interface (with build in security), and let Rybka make certain deliberate mistakes on other interfaces.

    
Parent - By Silvian (***) Date 2007-06-06 10:23 Edited 2007-06-06 10:39
"A practial way might be to have Rybka play perfect (no deliberate mistakes) on the Rybka interface (with build in security), and let Rybka make certain deliberate mistakes on other interfaces. "

Deliberate mistakes on Fritz 10 GUI,Shredder 10 GUI,ChessPartner 5.4GUI,Arena GUI..........?????? YOU ARE SEEK ! This will be the end of Rybka in computer chess.I think you must go this week to psycho-therapy!
So sorry,
Silvian

NB:In your "great & extreme academic  proposal" Rybka never can play at full strength with great chess engines like Fritz 10,Junior 10,Zap!Chess Zanzibar,all others CB & native engines.Do you know something about computer chess ??????????? (WB & UCI protocols are free but CB & natives are private protocols.To use Auto 232 needs two computers .........).
Parent - By grolich (***) Date 2007-06-06 10:40
Similar ideas have been investigated in the past.
They all failed.
It's simple. The first cloning attempts show the problem to the reverse engineer quite clearly.
The part which processes the bogus evals is in the code, and therefore on the second/third/fourth run the good reverse engineer WILL find it and bypass it. Some are even good enough to find it on the very first attempt.

Whatever defensive scheme you create, the possibility of bypassing it is created along with it.

Those guys are GOOD (well, some of them are). I've worked with a few that could read, understand, and rewrite machine code in such speed and efficiency that you'd freak out.

A practial way might be to have Rybka play perfect (no deliberate mistakes) on the Rybka interface (with build in security), and let Rybka make certain deliberate mistakes on other interfaces.

Then the built in security on the Rybka interface can be reverse engineered.

Of course, the more serious problem with that is that it will kill Rybka's sale the minute someone finds out and makes it public. Even if the effect on the playing strength is minimal, people will be outraged.

You can try spinning it any way you like, it has long been established that there is no real way to create a really good protection against cloning. The word "protection" is a bit misleading here.
If you talk about prevention, then it is simple: you're wrong, it can never be done.
No such protection exists because the relevant parts of the protection will run on the machine and can be broken themselves.

You can only make it more difficult. In that, it can be useful. But what's the point with a program that should be around for years?
All the modern protection schemes have one idea in mind: "delay, delay, delay".

So say you build the "ultimate" (no such thing, but.....) anti cloning protection scheme, which would delay the best reverse engineers in the world for quite a while (assuming they even care enough about Rybka to try it out).

What would you accomplish? so it will take a few months more than just doing it without the protection (I assumed it's one heck monster of a protection. Most last for a few weeks. And that is usually because no one cares enough about them to try it sooner).

Then it's cloned. hmm... what are you going to do now? trouble.

Of course, using the cloned code is trouble enough... And it will take tons of time to put it to good use in another engine.

But the protection itself is not what stops it from being cloned.

If you're truly worried about someone cloning a piece of code you wrote, there is a better way:
You can use watermarks. A general name for creating the code in a special way.
That "special" way the code is marked can be parsed as a reproducible output,
and attempts to clone the code would lead to the same reproducible output being generated by the same process of unmasking the watermark.

The requirement is that the odds of two such identical outputs on different pieces of code should be so low as to provide legal evidence of theft(it should be as close to zero as possible. My compiler instructor in the university showed me a watermark he used for a compiler he wrote once. The chance of reproducibility by accident were less than 1 in 2^1024).

There are many different types of watermarks,
and people come up with new ones all the time.

The advantage is that in contrast to direct protection schemes, it is PASSIVE. So running debuggers, monitors of any kind or anything like that is ineffective. You may never know it's there if you don't look for it, and since there are many new kinds invented all the times, you may miss it even if you are looking for one.

And, it gives you a legal leg to stand on, once the culprit finished his work...

Again, for Rybka, it would be unreasonable to even think about protection schemes...
It's silly.
It's too difficult to use the cloned info effectively. (possible, but takes quite a while).
you'll have to heavily modify the code after cloning if you want to avoid prosecution, because you'll be easily found out if you don't.
It's much easier to just write an engine yourself.
Parent - - By Sesse (****) Date 2007-07-28 21:21
I totally agree with your analysis, except that I believe you didn't state an important point: The purpose of any protection scheme is to increase the _cost_ of the copying/reverse-engineering, hopefully above what the value (monetary or otherwise) is to the attacker. I mean, if you put ten engineers to work a year or two decompiling Rybka, you could probably get the source code back, but at that point buying the source from Vas would probably be cheaper (and give you a much more current version, and less legal trouble). :-)

/* Steinar */
Parent - By Vasik Rajlich (Silver) Date 2007-07-30 09:45
You know, actually, if somebody wants to do this, it's not so bad. It's just the Rybka team's contribution to computer chess :)

Vas
Parent - By diepchess (*) Date 2009-11-22 22:36
There have been some protection programs where newer versions of it never have been actually cracked.
good example is newer versions of stopcopy. Only the first version or something they managed to crack.
how they managed to store stuff on a disk that no copying software could copy, it's until today a mystery to me.

Also really effective are toggles. However that's expensive hardware. Like $100 each to buy in.

Another problem that Gijsbert Wiesenecker told me, is that it is not really legal at company computers to save the signature of a user there.
So soon you need a card reader and save on a card for example the fingerprint of a person, simply as it's not allowed to save it on the computer.

Using more than a few bits for good encryption technology is also forbidden at severe sanctions (you're not even allowed to export it across
state borders under the threat of being exporter of weapon of mass destruction - see www.wassenaar.org).

So the big picture is simply that good protection is basically getting forbidden by law except if you store it at a device not actually physically located
inside the computer. Such solutions are too expensive for mass market software however.
Parent - By Quapsel (****) Date 2007-06-06 09:41
Toga ist Open Source,
and it is 100 Points behind Rybka.
and only 22 Points behind Loop 10.32, wich resides on the second place at
http://www.computerschach.de/index.php?option=com_wrapper&Itemid=222

Somone with interests in creating a strong Engine, using the work
of other programmers, will find here a better point to start.
legal!

Quap
Parent - By Berfomet (**) Date 2007-06-06 13:32
lol :-) :-) :-)
Having a sophisticated protection on a program like rybka is futile and a total waste of time.
Parent - - By Vasik Rajlich (Silver) Date 2007-06-07 09:08
You could decompile Rybka (trivial) and change some program values which change the style without destroying the playing strength (quite difficult).

This leaves you with a very easy-to-detect clone.

You could also (in theory) decompile Rybka and figure out what exactly she's doing. Just imagining this gives me a headache :)

Vas
Parent - - By Sesse (****) Date 2007-07-28 21:17
Vas, you keep saying that "decompiling" Rybka would be easy. Are you talking about a straight disassembly here, or a real decompile (ie. back into C)? I agree that the former would be easy, but I honestly believe the latter is really difficult, even if any existing software you'd want were available for the job.

/* Steinar */
Parent - By Vasik Rajlich (Silver) Date 2007-07-30 09:43
I believe that a straight decompile is a trivial step if you're willing to have meaningless variable names and all kinds of crud from various compiler optimizations like inlining, etc. Some language features like templates will also create a mess.

In fact, though, I've never tried it.

Vas
Parent - - By sam_i_am (**) Date 2007-07-29 19:08
Ever heard of Rocket 1.0beta ???

That's right bud ,

I

am the guy that reverse engineered it on mylivepage.com <(-_-<)

:P

not to be confused with later versions I might add

(>-_-)>
Parent - - By sam_i_am (**) Date 2007-07-29 19:09
just kidding .

hehe
Parent - By sam_i_am (**) Date 2007-07-29 19:11
I may as well could though , it is NOT as difficult as say many it is to reverse engineer a chess program.
Parent - - By kaustubh (**) Date 2007-07-28 15:35
How can you make a program which is stronger than rybka without decompiling rybka.
Parent - - By Harvey Williamson (*****) Date 2007-07-28 15:49
The question 2 years ago would be how can you make a program stronger than shredder without decompiling shredder?

Did Vas decompile Shredder - no
Parent - - By kaustubh (**) Date 2007-07-28 17:10
Vasik is a computer engineer from MIT. Second he must have seen code of some existing strong engine while making Rybka. Everyone decompiles to create his programs for example Compaq decompiled IBM bios to make the PC, OpenOffice was created by decompiling Microsoft office. There are many examples.
Parent - - By Harvey Williamson (*****) Date 2007-07-28 17:12
yes Crafty and fruit were both open source. Did vas do anything wrong - NO
Parent - - By Deep Thought (*) Date 2007-07-29 13:39
Is it possible to make a chess engine stronger than Rybka ? If yes who will make it.
Parent - - By Harvey Williamson (*****) Date 2007-07-29 13:54
who knows!?

If you asked the question 2 years ago who will make a program stronger than Shredder nobody would have replied Vas.

Harvey
Parent - By turbojuice1122 (Gold) Date 2007-07-29 20:49
That's incorrect--I think that Vas and his team would have :-)
Parent - By kaustubh (**) Date 2007-08-01 11:44
So we have to wait for 2 years to see if someone can create engine stronger than rybka
Parent - By Sesse (****) Date 2007-07-28 19:35
I'm sorry, but you don't have the slightest idea what you're talking about.

/* Steinar */
Parent - By Mekk (**) Date 2007-07-29 21:34
OpenOffice was created by decompiling Microsoft office

Very interesting claim. Any background for it?  For those interested: Open Office is derived from Star Office (office package developed by German firm called StarDivision in 199s, which was bought by Sun and open sourced later).

Regarding the rest. Some of the protection schemes work very well to ... irritate existing or possible customers. My own example: http://www.rybkaforum.net/cgi-bin/rybkaforum/topic_show.pl?pid=10481 (no, it has not been solved, I just abandoned the app).
Parent - - By Highendman (****) Date 2009-11-22 09:15
blast from the past :(
Parent - By Vasik Rajlich (Silver) Date 2009-11-22 11:50
:)

Dummy code is easy to remove via debugger.

Vas
Parent - By Uly (Gold) Date 2009-11-23 02:31
Was your intention that people would start replying to posts from 2 years ago?
Parent - By diepchess (*) Date 2009-11-22 22:24
hi SR,

It sure is not a problem to take a look in assembler to other engines; however this is only interesting if a program in question has something new that is interesting to study.

Vincent
Up Topic Rybka Support & Discussion / Rybka Discussion / How secure is the source code of Rybka?

Powered by mwForum 2.27.4 © 1999-2012 Markus Wichitill