Code Plagiarism - Technical Detection and Legal Prosecution

42
Code Plagiarism Technical Detection and Legal Prosecution Marc Ruef | Luca Dal Molin Security & Risk Conference October 26th - 29th 2011 Lucerne, Switzerland

description

The talk is discussing the basic problem of code theft and violation of licenses. As an example the popular case "ATK vs. XXXX" is retold. With this case as an example the coderecon tool is introduced to show how to identify stolen code with technical utilities. Afterwards the legal aspects of plagiarism and code theft is discussed. This includes current law and articles of a statute in Switzerland, Europe/EU and worldwide.

Transcript of Code Plagiarism - Technical Detection and Legal Prosecution

Page 1: Code Plagiarism - Technical Detection and Legal Prosecution

Code PlagiarismTechnical Detection and Legal Prosecution

Marc Ruef | Luca Dal Molin

Security & Risk ConferenceOctober 26th - 29th 2011Lucerne, Switzerland

Page 2: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Hashdays 2011

Agenda | Code Plagiarism – Detect & Prosecute1. Intro

Introduction2

min

What is Code Plagiarism3

min

2. ATK Case

How it all began5

min

Technical Analysis10

min

Legal Problems10

min

Media Rampage10

min

Additional Details5

min

4. Outro

Summary2

min

Questions3

min

2/42

Page 3: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Hashdays 2011

Introduction | Who is Marc

Name Marc Ruef

Job Co-Owner / CTO, scip AG, Zürich

Private Website http://www.computec.ch

Last Book „The Art of Penetration Testing“,Computer & Literatur Böblingen,ISBN 3-936546-49-5

Translation

3/42

Page 4: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Hashdays 2011

Introduction | Who is Luca

Name Luca Dal Molin

Job Associate at Homburger AGMember of Practice Team “IP|IT”

Corp. Website http://www.homburger.ch

4/42

Page 5: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Introduction | What is Code Plagiarism

“The practice of taking someone else’s work or ideas and passing them off as one’s own.”

Oxford English Dictionary,http://oxforddictionaries.com/definition/plagiarism

Hashdays 2011 5/42

Page 6: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

ATK Case | Once upon a time ...

Hashdays 2011

20036/42

Page 7: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

There was an idea ...

Page 8: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

... to help me exploit vulnerabilities.

Page 9: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

And the Attack Tool Kit was born!

Page 10: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

The ATK became pretty popular :)

Page 11: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

One day I received an email from a friend ...

Page 12: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

So I downloaded the scanner and took a look ... wtf?!

Page 13: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

I have sent a letter to them to request to obey Copyright + GPL

Page 14: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

They said: «We can’t see your problem. Please go away!»

Page 15: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

I said: «No, please, be kind ...»

Page 16: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

They said: «F—k off, we really don’t care. Really!»

Page 17: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Technical Analysis | Source Code Analysis

Hashdays 2011

◦ Strings◦ Names, Title◦ Copyright

◦ Names◦ Variables, Constants◦ Functions, Methods, Classes◦ Objects, Elements

◦ Structures◦ Programming Style (indentation, vertical alignment)◦ Conditional Statements (if, for, until, switch, goto)◦ Pattern, Regex◦ Dataflow

17/42

Page 18: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

I need solid proof. Some reversing helps ...

Page 19: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Plagiarism has some pitfalls ...

◦ Some original plugins were using arbitrary strings for requests and pattern matching. Therefore the string «atk» was part of many plugins in the original software. It made it also into their product (see screenshot). [12 plugins affected]

◦ Some plugins were realizing outbound tests. I have used a small daemon on my website www.computec.ch to determine the success. So did they. [1 plugin affected]

◦ Some plugins were using arbitrary dates/numbers too. Whenever possible I have used my birthday 11-02-1981. It made it also into their product. [2 plugins affected]

◦ Some plugins included typos and minor errors. Those made it also into their product. [5 plugins affected]

Page 20: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

... so I gave them a last chance ...

Page 21: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

... which they ignored. But tried to cover up :)

◦ Some plugins were altered to hide the obvious – Especially within the new release after my technical letter.

◦ Those changes usually destroyed the purpose of the code and rendered the checks useless! For example:

◦ The exfiltration tests were always negative if their website wasn’t hosting my daemon (which was not part of the ATK package) [3 plugins affected]

Page 22: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Legal Problems | Threshold for Copyright

Hashdays 2011

◦ Article 2 of the Swiss Copyright Act:1. Works shall mean literary and artistic creations of the

mind, irrespective of their value or purpose, that possess an individual nature.

2. […]3. Computer programs shall also be deemed works.4. Protection shall also subsist in drafts, titles and parts

of works on condition that they are creations of the mind with an individual nature.

◦ Key elements of the definition:◦ Creation of the mind◦ Individuality

22/42

Page 23: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Legal Problems | Threshold for Copyright

Hashdays 2011

◦ Software: ◦ Idea | plan◦ Object code | source code

◦ Case law (decision of the Zurich Court of Appeals, sic! 2009, p. 230): ◦ Very low threshold in terms of individuality◦ Exclusion of banal or trivial software

◦ Consequence:◦ As a matter of principle, software is generally

protected by the Copyright Act◦ Copyright protection is denied with regard to banal

software

23/42

Page 24: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Legal Problems | Other Possible Protection

Hashdays 2011

◦ Patent law?◦ Brand | design?◦ Unfair Competition Act?

24/42

Page 25: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

My options were: No. 1 – Legal Prosecution

◦ Had contact with differend lawyers from different countries (Switzerland, Germany, USA)

◦ Had contact with Free Software Foundation (FSF)

◦ There were multiple difficulties:

◦ Such a legal case in Switzerland was «unique» until then

◦ My legal insurance wasn’t covering «copyright violations» (no legal insurance in Switzerland was/is)

◦ It would cost me a not definable amount of money to prosecute

◦ The chances were zero to gain indemnity (because I distributed the ATK for «free» and therefore had no calculable loss of income).

◦ Within a trial I would have lost money anyway (that’s not my idea of an open-source project).

◦ Because I have waited a long time, I wasn’t able to enforce «immediate legal actions» anymore.

Page 26: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

My options were: No. 2 – Media Rampage :)

◦ For me it wasn’t about the money. It was about law and justice ... and for the lulz!!1

◦ I started to prepare a broad media offensive.

Page 27: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

If I don’t get enough attention, then I may go public!

Page 28: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

But who did it?

Page 29: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

I tried to contact my «old friend» ... But he ignored me :(

Page 30: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

But wait? I know him and own his code too! :)

Page 31: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Then they claimed that I was lying. (I didn’t like that!)

Page 32: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

By accident I’ve got access to their «expert opinion» ...

Page 33: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Evidence admitted in court

Hashdays 2011

◦ How does a court establish whether a violation of a copyright has occurred?◦ Expert opinion◦ Value of a private expert opinion?

◦ What will the expert analyze:◦ Description of the software | plan?◦ Functionalities?◦ Source Code?◦ Object Code?

33/42

Page 34: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

I’m sorry, not everyone is an «expert»!

◦ There is a list of funny typos (e.g. «exploits» became «exploids»). (pp. 12) He might not be a language expert (there are many typos).

◦ He did compare the compiled software and not the source-code. (pp. 10) Not a brilliant approach to comment on a «code theft accusation».

◦ His argument why «to borrow» my code is legitimate was, that I have mentioned GPL just somewhere «hard to find». The project was therefore «open-source» and I have lost all my rights. (pp. 4) This conclusion is just plain stupid. You don’t lose copyrights by publishing the source code!

◦ On some pages he disapproved that those were the same plugins. On others he argued that the match might by «just by accident». (pp. 4, 9, 12, 15) Yeah sure, 380 plugins with the exact same 1.716 commands are just magical coincidence!

◦ The «expert opinion» contained a copy of the WikiPedia page about «General Public License». (pp. 22-26) Some say WP and Expert can’t be mentioned within the same sentence ;)

Page 35: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Details | Particularities OSS and GPL

Hashdays 2011

◦ Copyright protection of OSS in general◦ With regard to GPL in particular:

◦ How to validly include GPL when distributing software◦ Rights and obligations of the licensor◦ Rights and obligations of the licensee◦ Copyleft◦ Auto-termination in case of violations

◦ Differences Copyright Act | GPL

35/42

Page 36: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Details | What should Marc have done?

Hashdays 2011

◦ With regard to the inclusion of GPL?◦ Act quickly!◦ Act decisively!◦ Safeguard potential evidence

36/42

Page 37: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

One more thing ...

◦ In version 1.8 they fragged their http engine. Because all http requests missed proper CRLF at the end, the http checks were rendered useless. 100% false-negatives!

◦ The «stresstest module» didn’t work if the http:// was missing in the target definition (which was no requirement and did not show a warning message). 100% false-negatives!

◦ The «webspider module» wasn’t able to collect file and path names which start with a dot. Have fun testing .htaccess files! More false-negatives!

◦ The «lan viewer module» did freeze the whole application if you clicked onto something during discovery mode. Denial of Service

◦ The «port scan module» did a full-connect without a timeout to every open destination port. Http services lead to denial of service. But chargen lead to memory corruption and code execution Pwnd by your target!

Page 38: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Summary

◦ Legal prosecution is not easy.◦ Act quickly and take a good lawyer! #lfmf◦ Licenses and copyrights aren’t the same. You don’t lose a

copyright by publishing the source code.◦ Fight for your right as long as you’re sure about it.

Hashdays 2011 38/42

Page 39: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Hashdays 2011

Literature

◦ ATK vs. ◦ ATK Project gegen (2006),

http://www.computec.ch/news.php?item.117◦ ATK gegen , Teil 2: Rückzug? (2006), http://

www.computec.ch/news.php?item.120◦ ATK gegen , Teil 3: Siege und Niederlagen,

http://www.computec.ch/news.php?item.126◦ ATK gegen - Technische Beweisführung

(2007), http://www.computec.ch/download.php?view.889

39/42

Page 40: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Questions

Hashdays 2011

?40/42

Page 41: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Hashdays 2011

Thank you for your Attention!

Homburger AGPrime TowerHardstrasse 201CH-8005 Zurich

Tel +41 43 222 10 00Fax +41 43 222 15 00Mail

[email protected] http://www.homburger.ch

41/42

Page 42: Code Plagiarism - Technical Detection and Legal Prosecution

Intro

Who?

What?

ATK Case

How it began

Technical Analysis

Legal Problems

Media Rampage

Additional Details

Outro

Summary

Questions

Hashdays 2011

Security is our Business!

scip AGBadenerstrasse 551CH-8048 Zürich

Tel +41 44 404 13 13Fax +41 44 404 13 14Mail [email protected] http://www.scip.chTwitter

http://twitter.com/scipag

Strategy | Consulting Auditing | Testing Forensics | Analysis

42/42