DE102007059798B3 - Executable program code i.e. executable file, coding method for computer, involves combining chains of sequential instructions to code fragments, and coding and storing detected code fragments belonging to methods in program library - Google Patents
Executable program code i.e. executable file, coding method for computer, involves combining chains of sequential instructions to code fragments, and coding and storing detected code fragments belonging to methods in program library Download PDFInfo
- Publication number
- DE102007059798B3 DE102007059798B3 DE200710059798 DE102007059798A DE102007059798B3 DE 102007059798 B3 DE102007059798 B3 DE 102007059798B3 DE 200710059798 DE200710059798 DE 200710059798 DE 102007059798 A DE102007059798 A DE 102007059798A DE 102007059798 B3 DE102007059798 B3 DE 102007059798B3
- Authority
- DE
- Germany
- Prior art keywords
- code
- program
- address
- program code
- fragments
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 239000012634 fragment Substances 0.000 title claims abstract description 104
- 238000000034 method Methods 0.000 title claims abstract description 100
- 238000012545 processing Methods 0.000 claims abstract description 12
- 230000003936 working memory Effects 0.000 claims description 7
- 238000000547 structure data Methods 0.000 claims description 3
- 239000000470 constituent Substances 0.000 claims 1
- 230000015654 memory Effects 0.000 abstract description 16
- 230000006870 function Effects 0.000 description 9
- 238000000605 extraction Methods 0.000 description 3
- 239000007787 solid Substances 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 238000001514 detection method Methods 0.000 description 2
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 238000013467 fragmentation Methods 0.000 description 1
- 238000006062 fragmentation reaction Methods 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 230000001681 protective effect Effects 0.000 description 1
- 230000000306 recurrent effect Effects 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/10—Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
- G06F21/12—Protecting executable software
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/10—Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
- G06F21/12—Protecting executable software
- G06F21/14—Protecting executable software against software analysis or reverse engineering, e.g. by obfuscation
Abstract
Description
Die Erfindung betrifft ein Verfahren zur Verschlüsselung von ausführbarem Programmcode. Bei dem Programmcode kann es sich z. B. um eine ausführbare Datei im bekannten EXE Format oder z. B. eine Dynamic Link Library DLL handelt, welche Maschinencode, Daten und Ressourcen in beliebigen Kombinationen enthalten können.The The invention relates to a method for encrypting executable Program code. The program code may be z. For example, an executable file in the known EXE format or z. For example, a dynamic link library DLL is what machine code, data and resources in any Combinations may contain.
Bekannte Verfahren zum Schutz von Anwenderprogrammen gegen unautorisierten Betrieb, Manipulation und unautorisierte Vervielfältigung beruhen darauf, dass mit Hilfe einer speziellen Schutzsoftware diverse Sicherheitschecks mit einem positiven Ergebnis durchgeführt werden müssen, bevor diese Anwenderprogramme ausgeführt werden kann. Derartige Schutzsoftware führen hierzu bekannte Sicherheitschecks durch, wie z. B. die Verifikation von Checksummen, eine Debugger Detection, u. s. w.. Doch wie das zu schützende Programm, sind auch diese Sicherheitschecks in Software implementiert. Selbst wenn zusätzliche Hardware eingesetzt wird, wie z. B. ein Dongle, welcher zur Freigabe des Betriebs von Programmen an einer Schnittstelle eines ausführenden Rechners gesteckt sein muss, überprüfen die Sicherheitschecks somit die zu schützende Software wiederum mit Software.Known Method for protecting user programs against unauthorized Operation, manipulation and unauthorized duplication are based on the fact that with the help of a special protection software diverse Safety checks are carried out with a positive result have to, before these application programs can be executed. such Protective software lead this known security checks by, such. B. the verification of checksums, a debugger detection, u. s. w .. But like that program to protect These security checks are also implemented in software. Even if additional Hardware is used, such. B. a dongle, which for release the operation of programs at an interface of an executing Calculator must be plugged, check the Security checks thus the software to be protected with turn Software.
Bei derartigen Sicherheitschecks tritt das Problem auf, dass diese trotz aller Komplexität am Ende zu einer bedingten Entscheidung führen, ob nämlich das Programm tatsächlich ausgeführt bzw. fortgesetzt werden darf oder blockiert bzw. abgebrochen werden muss. Eine solche bedingte Entscheidung stellt wiederum selbst einen in der Regel kurzen, klar abgrenzbaren Bereich von Programmcode dar. Es ist somit möglich, den Bereich an Programmcode, welcher eine derartige finale bedingte Entscheidung über die Ausführung oder Sperrung eines übergeordneten Programms repräsentiert, selbst in einem umfangreichen Programmlisting einer Schutzsoftware zu identifizieren. Es ist dann ohne weiteres möglich, selektiv die bedingte Entscheidung durch Manipulation unwirksam zu machen, also quasi die Bedingung zu überschreiben, so dass das auszuführende Programm unabhängig von dieser Bedingung in jedem Fall uneingeschränkt ausgeführt wird. Auf dieses Weise kann ein Sicherheitscheck unabhängig von der Vielzahl und Komplexität der von ihm während des Prüfablaufes vorgenommenen Plausibilitätsüberprüfungen unwirksam gemacht werden.at such safety checks, the problem arises that this despite of all complexity lead to a conditional decision as to whether the program is actually executed or may be continued or blocked or aborted. Such a conditional decision, in turn, sets one yourself usually short, clearly demarcated area of program code. It is thus possible the range of program code which has such a final conditional Decision over execution or blocking a parent Program represents, even in a comprehensive program listing of a protection software to identify. It is then readily possible to selectively conditional Decision by manipulation ineffective, so to speak to override the condition so that the executable Program independent In any case, this condition is executed without restriction. In this way can be a security check independently from the variety and complexity the one from him while the test procedure made plausibility checks ineffective be made.
Ein weiteres Problem einer Vielzahl von kommerziellen Implementierungen von Schutzsoftware z. B. gegen unautorisierte Vervielfältigung eines Programms wird darin gesehen, dass die darin implementierten Sicherheitschecks quasi statisch sind. Dies hat zur Folge, dass unabhängig davon, welches Programm mit einer bestimmten Schutzsoftware abgesichert werden soll, die darin implementierten Sicherheitschecks immer identisch sind. Derartig wiederkehrende Schutzsoftware stellt somit eine Art von „digitalem Fingerprint" dar. Dieser kann selbst dann, wenn er im umfangreichen Listing eines beliebigen Programms implementiert ist, gefunden und durch eine manipulierte Version ersetzt werden. Es ist sogar möglich, derartige Manipulationen quasi zu automatisieren. Hierzu ist es möglich, einen so genannten „Crack" zu erstellen. Hierbei handelt es sich um ein Computerprogramm, welches zur Manipulation einer bestimmten, bekannten Schutzsoftware dient. Ein solcher „Crack" kann z. B. über das Internet verteilt werden, und steht dann zur universellen Manipulation eines jeden Programms zur Verfügung, bei dem die bekannte Schutzsoftware verwendet wird.One further problem of a variety of commercial implementations of protection software z. B. against unauthorized duplication of a program is seen to be implemented in it Security checks are virtually static. This has the consequence that independently of which program is secured with a specific protection software should always be identical to the security checks implemented in it are. Such recurrent protection software is thus a kind from "digital Fingerprint "dar. This can be even if he is in the extensive listing of a any program is implemented, found and by a be replaced manipulated version. It is even possible, such Automating manipulations, so to speak. For this it is possible to have a so-called "crack" to create it is a computer program used for manipulation a specific, known protection software is used. Such a "crack" can, for example, over the Internet are distributed, and then stands for universal manipulation of every program available, where the known protection software is used.
Zur Vermeidung der oben dargestellten Probleme kann in einem ersten Schritt die Schutzsoftware selbst vor Manipulationen geschützt werden. Dies kann z. B. durch den Einsatz einer Verschlüsselung erreicht werden. Dazu können gängige Verschlüsselungsstandards, wie z. B. AES, d. h. Advanced Encryption Standard, verwendet werden. Es ist jedoch bekannt, dass die einfache Verschlüsselung von ausführbaren Programmen, wie z. B. ausführbare Dateien mit der Dateina menserweiterung EXE oder dynamisch ladbare Bibliotheken, d. h. eine Dynamic Link Library DLL, unter dem Betriebssystem WINDOWS, ebenfalls nicht sicher gegen Manipulation ist. Zur berechtigten Ausführung solcher Programme müssen diese nämlich in den Arbeitsspeicher eines Rechners geladen und dort dekodiert werden. Nachdem diese Schritte ausgeführt wurden, kann das gesamte Programm nun unverschlüsselt wieder aus dem Speicher ausgelesen werden. Es liegt nun in völlig ungeschützter Form vor und kann auf einfache Weise zum Ziel von herkömmlichen Manipulationen werden.to Avoiding the problems outlined above can be a first Step the protection software itself are protected from manipulation. This can be z. B. be achieved by the use of encryption. To can common Encryption standards, such as AES, d. H. Advanced Encryption Standard, to be used. However, it is known that the simple encryption of executable Programs, such. B. executable Files with file extension EXE or dynamically loadable Libraries, d. H. a dynamic link library DLL, under the operating system WINDOWS, too, is not safe against manipulation. To the legitimate execution of such programs these namely loaded into the memory of a computer and decoded there become. After these steps have been performed, the entire Program now unencrypted be read out of memory again. It is now in completely unprotected form before and can easily become the target of conventional Manipulations are.
Aus
der
Der Erfindung liegt die Aufgabe zu Grunde ein Verschlüsselungsverfahren anzugeben, welches ein programmspezifisches und damit gegen Angriffe erheblich robusteres Verschlüsselungsergebnis bereitstellt.Of the The invention is based on the object of an encryption method specify which program-specific and thus against attacks much more robust encryption result provides.
Die Aufgabe der Erfindung wird mit den Merkmalen der im Anspruch 1 angegebenen gelöst. Weitere vorteilhafte Ausführungsformen der Erfindung sind in den Unteransprüchen angegeben.The The object of the invention is specified with the features of claim 1 solved. Further advantageous embodiments The invention are specified in the subclaims.
Für die Definition der Erfindung und die Erläuterung von in den Figuren dargestellten Beispielen wird nachfolgend der Begriff METHODEN verwendet. Hierunter werden die von einer Programmiersprache bereitgestellten Funktionen oder Prozeduren verstanden. Handelt es sich z. B. um eine objektorientierte Programmiersprache, so entsprechen die METHODEN den einer Klasse von Objekten zugeordneten Algorithmen.For the definition the invention and the explanation of examples shown in the figures is hereinafter the Term METHODS used. Below are those of a programming language understood functions or procedures. These it is z. B. to an object-oriented programming language, so correspond the METHODS are the algorithms associated with a class of objects.
Zur Durchführung des erfindungsgemäßen Verfahrens wird in einem ersten Schritt von einer Verarbeitungseinheit ausführbarer Programmcode unmodifiziert direkt in den Arbeitsspeicher einer Verarbeitungseinheit kopiert. Vorteilhaft erfolgt dies durch ein manuelles Laden des zu extrahierenden Programmcodes in den Speicher. Dies hat den Zweck zu verhindern, dass der zu extrahierende Programmcode durch den Ladevorgang in irgendeiner Weise verändert wird. Würde stattdessen der Ladevorgang mit Hilfe von Mitteln eines Betriebssys stems, z. B. mit dem Loader eines Betriebssystems, durchgeführt werden, so würde dabei der Maschinencode bereits für eine spätere Ausführung durch das Betriebssystem vorbereitet werden, d. h. Maschinencode Relocation würde durchgeführt und damit der Maschinencode modifiziert werden. Dies wäre aber hinderlich für einen erfolgreichen Ablauf des erfindungsgemäßen Verfahrens.to execution the method according to the invention becomes more executable by a processing unit in a first step Program code unmodified directly into the memory of a processing unit copied. This is advantageously done by manually loading the to be extracted program codes in the memory. This has the purpose to prevent the program code to be extracted by the Charging process is changed in any way. Would instead the charging process by means of a Betriebsssys stems, z. With the loader of an operating system, so would while the machine code already for later execution by the operating system be prepared, d. H. Machine code relocation would be done and so that the machine code can be modified. But that would be hindering for a successful operation of the method according to the invention.
In einem zweiten Schritt werden zur Identifikation der einzelnen Methoden des Programmcodes Strukturdaten direkt ausgewertet. Hierzu geeignete Strukturdaten sind insbesondere z. B. PE-Header-Daten, d. h. Portable Executable File Format Daten, mit denen einer symbolischen Adressierung eine reale Adressierung zugeordnet werden kann, und z. B. Relocation Tabellen. In diesem zweiten Schritt wird die komplette datentechnisch Strukturierung des Programmcodes in dessen einzelne Funktionen bzw. Methoden analysiert. Dabei werden insbesondere die Funktions-Einsprungadressen der DLL ermittelt. Zur Erhaltung der ursprünglichen Form der Daten ist es auch hier notwendig, dass die Auswertung der Strukturdaten direkt und nicht unter zu Hilfenahme von Befehlen eines Betriebssystems erfolgt.In a second step will be to identify the individual methods of the program code structure data is evaluated directly. Suitable for this purpose Structure data are in particular z. B. PE Header Data, d. H. Portable Executable file format data that uses a symbolic addressing a real addressing can be assigned, and z. Eg relocation Tables. In this second step, the complete data technology Structuring the program code into its individual functions or Methods analyzed. In particular, the function entry addresses the DLL detects. To preserve the original form of the data is it also necessary here that the evaluation of the structural data directly and not with the help of commands from an operating system he follows.
Nach dieser Identifikation der Methoden, d. h. insbesondere der Erfassung von deren Einsprungsadressen, wird in einem dritten Schritt eine vollständige Analyse bzw. Disassemblierung des Programmcodes durchgeführt. Dieser Vorgang wird auch statische Maschinencode Analyse oder Parsing von Maschinencode genannt. Hierzu wird der Programmcode von jeder Methode bzw. Funktion auf Bestandteile abgesucht, welche zur Runtime eine Unterbrechung in der sequentiellen Abarbeitung des Programmcodes verursachen würden. Bei diesen Bestandteilen handelt es sich insbesondere um bedingte und unbedingte Sprungbefehle und Rücksprungsbefehle, welche den Programmablauf beenden. Bedingte Sprünge entsprechen logischen Abzweigungen. Falls solche Abzweigungen im Maschinencode entdeckt werden, so werden auch alle davon abgehenden Programmpfade weiter verfolgt und in entsprechender Weise abgesucht.To this identification of the methods, d. H. in particular the detection of their entry addresses, in a third step, a full Analysis or disassembly of the program code performed. This Operation will also static machine code analysis or parsing of Machine code called. This will be the program code of each method or function scanned for components, which at runtime a Interruption in the sequential processing of the program code would cause. at these components are in particular conditional and unconditional jump instructions and return instructions, which terminate the program. Conditional jumps correspond to logical branches. If such branches are detected in the machine code, then also pursued all outgoing program paths and in searched accordingly.
In der Praxis wird beim Parsing in der Regel ausgehend von der Einsprungsadresse einer jeden Methode der sich anschließende Maschinencode durch Auslesen des Speichers disassembliert und auf die oben genannten Elemente abgesucht, welche eine Unterbrechung des linearen Programmablaufes, d. h. eine Unterbrechung der Abarbeitung von in unmittelbar aufeinander folgenden Speicherzellen des Arbeitsspeichers enthaltenem Maschinencode, verursachen.In The practice is parsing usually starting from the entry address each method of the subsequent machine code by reading of the memory disassembled and on the above elements which interrupts the linear program sequence, d. H. an interruption of the processing of in immediate succession following memory cells of the main memory contained machine code, cause.
Nach Abschluss der Ablaufverfolgung des Programmcodes werden in einem vierten Schritt Codefragmente gebildet. Dies kann auch als Extraktion bezeichnet werden. Derartige Codefragmente sind Ketten von unmittelbar aufeinander folgenden, zur Rumtime linear hintereinander ausgeführten Anweisungen im Programmcode. Codefragmente sind also zusammenhängende Gruppen von Maschinencode. In der Praxis werden hierbei die Codefragmente in der Regel derart aus dem ursprünglichen Programmcode extrahiert, dass diese z. B. durch entsprechende Adressbezüge miteinander verbunden sind, so dass bei einem Ablauf dieser Codefragmente zur Runtime die gleichen Funktionen bereitgestellt werden, wie sie bei einem Ablauf des ursprünglichen, nicht mit dem erfindungsgemäßen Verfahren behandelten Programmcodes auftreten würden.To Completing the trace of the program code will be in one fourth step formed code fragments. This can also be as an extraction be designated. Such code fragments are chains of immediate successive, to the Rumtime linear consecutively executed instructions in the program code. Code fragments are thus contiguous groups of machine code. In practice, here are the code fragments usually extracted in such a way from the original program code, that these z. B. are interconnected by appropriate address references, so that at expiration of these code fragments at runtime the same Functions are provided, as in the expiration of the original, not with the method according to the invention treated program codes would occur.
Das erfindungsgemäße Verfahren hat zur Folge, dass ein gemäß der Erfindung gebildetes Codefragment insbesondere entweder mit der zur jeweiligen Methode gehörigen Einsprungadresse oder mit der Zieladresse einer Abzweigung beginnt. Weiterhin endet ein Codefragment insbesondere dann, wenn während der Programmablaufverfolgung entweder eine übliche programmtechnische Endebedingung, wie z. B. ein RET Befehl, oder ein absoluter Sprungbefehl, wie z. B. ein JMP Befehl, detektiert wurden. Gemäß einer weiteren Ausführung der Erfindung können diese Codefragmente vorteilhaft durch ihre Startadresse und Länge definiert werden. Als LÄNGE kann hierzu z. B. die Anzahl der zwischen End- und Startadresse eines Codefragments liegenden Bytes an Maschinencode dienen. Es wird also für jede einzelne der Methoden, die z. B. ein Programm oder eine DLL repräsentieren, ein kompletter Baum aus den Codefragmenten erstellt, welche die einzelne Methode repräsentieren.The result of the method according to the invention is that a code fragment formed according to the invention can be used in particular either with the entry address belonging to the respective method or with the destination address of a branch begins. Furthermore, a code fragment ends, in particular, when during program tracing either a common program-technical end condition, such. As a RET command, or an absolute jump command such. As a JMP command were detected. According to a further embodiment of the invention, these code fragments can be advantageously defined by their start address and length. As a LENGTH z. B. serve the number of lying between the end and start address of a code fragment bytes of machine code. So it is for each of the methods that z. For example, to represent a program or a DLL, a complete tree is created from the code fragments that represent the single method.
Die Extraktion der Codefragmente aus dem Maschinencode eines Programms oder einer DLL in der erfindungsgemäßen Weise bietet nun den besonderen Vorteil, dass in einem fünften und letzten Schritt die gefundenen Codefragmente, welche zu einer Methode gehören, individuell verschlüsselt und in einer Programmbibliothek abgelegt werden können. Vorteilhaft kann diese Programmbibliothek kann wiederum selbst zusätzlich speziell verschlüsselt werden.The Extraction of the code fragments from the machine code of a program or a DLL in the manner according to the invention now offers the special Advantage that in a fifth and last step, the found code fragments, which to a Include method, individually encrypted and can be stored in a program library. Advantageous In turn, this library can be self specific in addition encoded become.
Im Ergebnis wird also ein dem erfindungsgemäßen Verfahren unterzogenes ausführbares Programm oder eine Dynamic Link Library DLL durch die Programmbibliothek der einzeln verschlüsselten Codefragmente repräsentiert. Hiermit ist der besondere Vorteil verbunden, dass diese Programmbibliothek genauso individuell ist wie der ursprüngliche Programmcode selbst. Die Art der Verschlüsselung ist also vom jeweiligen Aufbau des Programmcodes abhängig und führt somit bei jedem Programmcode zu einem völlig unterschiedlichen Ergebnis. Dies macht es für einen Angreifer im Vergleich zum oben beschriebenen Stand der Technik erheblich viel schwerer, in die verschlüsselte Programmbibliothek der einzeln verschlüsselten Codefragmente eines individuellen Programmcodes einzudringen.in the The result is therefore subjected to the process according to the invention executable Program or a dynamic link library dll through the program library the individually encrypted Represents code fragments. This has the special advantage that this program library just as individual as the original program code itself. The type of encryption So depends on the particular structure of the program code and thus leads with each program code to a completely different result. This makes it for an attacker compared to the prior art described above much heavier in the encrypted program library of individually encrypted Code fragments of an individual program code.
Zusammengefasst werden bei dem erfindungsgemäßen Verfahren ausführbare Dateien bzw. Programme einer statischen Maschinencodeanalyse unterzogen, und dabei methodengranular extrahiert und verschlüsselt. Hierzu wird ein zu verschlüsselndes Programm mit dem erfindungsgemäßen Verfahren derart fragmentiert, dass alle darin enthaltenen Methoden in Form von geschlossenen Codefragmenten extrahiert, separat verschlüsselt und dann getrennt abgespeichert werden. Dabei stellt ein geschlossenes Codefragment eine Folge von Befehlen z. B. in einer Assemblerprogrammiersprache dar, deren Maschinencode in einem Arbeitsspeicher eine lückenlose Kette von aufeinander folgend abzuarbeitenden Anweisungen darstellt. Abhängig vom Umfang des zu verschlüsselnden Programms können dabei natürlich Methoden des gleichen Typs, aber mit unterschiedlichen Parametern, in großer Vielzahl auftreten. Alle diese Methoden werden erfindungsgemäß in einzelne, methodenbezogene und separat verschlüsselte Codefragmente extrahiert, durch deren Summe dann die ausführbare Datei bzw. das Programm repräsentiert wird.Summarized be in the inventive method executable Subjected files or programs to a static machine code analysis, and methodically extracted and encrypted. For this becomes a to be encrypted Program with the method according to the invention so fragmented that all the methods contained in it in form extracted from closed code fragments, encrypted separately and then be stored separately. It represents a closed Code fragment a sequence of commands e.g. In an assembler programming language whose machine code in a working memory a gapless Chain of instructions to be processed sequentially. Depending on Scope of the program to be encrypted can of course Methods of the same type but with different parameters, in big Variety occur. All these methods are inventively in individual, extracted method-related and separately encrypted code fragments, by the sum then the executable File or program represents becomes.
Das erfindungsgemäße Verfahren hat den Vorteil, dass ausführbare Dateien bzw. Programme weder linear noch vollständig verschlüsselt, anschließend wieder linear entschlüsselt und geschlossen von einem Prozessor ausgeführt werden. Vielmehr werden diese nach dem erfindungsgemäßen Verfahren methodenbezogen in separat verschlüsselte Codefragmente zerteilt. Nur die während eines Programmablaufs aktuell benötigten Codefragmente werden zur Runtime entschlüsselt und separat ausgeführt. Selbst wenn einem Angreifer das Auslesen einer momentan entschlüsselten Methode gelänge, so erlaubt dies weder eine Manipulation der verschlüsselten Bibliothek, noch einen Rückschluss auf die Gesamtheit des Programms, in dem diese Methode neben vielen anderen enthalten ist.The inventive method has the advantage of being executable Files or programs neither linear nor fully encrypted, then again decoded linearly and closed by a processor. Rather, be this according to the inventive method methodically divided into separately encrypted code snippets. Only the while program fragments are currently required code fragments decrypted for runtime and executed separately. Even if an attacker reading a currently decrypted Method, so this does not allow any manipulation of the encrypted Library, one more conclusion on the whole of the program in which this method in addition to many other is included.
Das erfindungsgemäße Verfahren hat den weiteren Vorteil, dass bei der späteren Ausführung eines gemäß der Erfindung verschlüsselten Programms dessen methodenbezogenen Unterprogramme nur bei Bedarf an eine zufällige Stelle in den Arbeitsspeicher geladen, dekodiert und ausgeführt werden können. Anschließend werden diese Unterprogramme wieder aus dem Speicher entfernt. Auf diese Art befindet sich zu keinem Zeitpunkt der gesamte Maschinencode unverschlüsselt im Arbeitsspeicher und kann folglich auch nicht geschlossen ausgelesen werden. Selbst einzelne methodenbezogene Unterprogramme können nur mit Aufwand ausgelesen werden, da diese sich nur für die Zeit der Ausführung, d. h. zur Runtime, im Arbeitsspeicher befinden und nicht vorgesagt werden kann, an welcher Stelle diese in den Arbeitsspeicher geladen wurden.The inventive method has the further advantage that in the later execution of one according to the invention encrypted Program whose method-related subroutines only when needed to a random one Place in the memory loaded, decoded and executed can. Subsequently these subprograms are removed from memory again. On this type is at no time the entire machine code unencrypted in memory and therefore can not be read closed become. Even individual method-related subroutines can only be read with effort, as these are only for the time the execution, d. H. at runtime, in memory and not predicted can be where they are loaded into memory were.
In Ausnahmefällen kann bei der Durchführung des erfindungsgemäßen Verfah rens der Fall eintreten, dass beim Parsing einer Methode nicht nur absolute, sondern auch dynamische Sprungadressen zu speziellen Codefunktionen detektiert werden. Die tatsächlichen Adresswerte dieser Sprungziele stehen während der Durchführung des Verfahrens noch nicht zur Verfügung, sondern sind erst im Moment der Laufzeit des Programms dynamisch ermittelbar. Derartige Ausnahmefälle welche bei Verwendung von Funktionspointern auftreten, können gemäß einer vorteilhaften, weiteren Ausführung der Erfindung durch eine explizite Referenzierung der dynamischen Sprungziele korrigiert werden. Hierdurch können auch Funktionen, welche durch Funktionspointer aufgerufen werden, in die erfindungsgemäße Maschinencode Extraktion miteinbezogen werden, und stehen zur Laufzeit zur Verfügung.In exceptional cases, when carrying out the method according to the invention, it may happen that during the parsing of a method not only absolute, but also dynamic jump addresses to specific code functions are detected. The actual address values of these jump destinations are not yet available during the execution of the method, but can only be determined dynamically at the moment the program is running. Such exceptional cases which occur when using function pointers, according to an advantageous, further embodiment of the invention by an explicit Referenzie correcting the dynamic jump targets. As a result, functions which are called by function pointers can also be included in the machine code extraction according to the invention, and are available at runtime.
Weiterhin kann der Fall eintreten, dass sich die nach Durchführung des erfindungsgemäßen Verfahrens ergebenden Codefragmente überlappen. Eine solche Überlappung tritt vor allem dann auf, wenn ein Sprungbefehl nicht den Anfang eines bereits bekannten Codefragments referenziert, sondern nachfolgende Befehle davon referenziert. Dies bedeutet also, dass die Anfangs- und/oder Endadresse eines Codefragments im Inneren eines anderen Codefragments liegt. Dies würde zu einem inkorrekten Ergebnis führen, welches nicht ablauffähig wäre. Gemäß einer weiteren Ausgestaltung der Erfindung kann eine derartige Überlappung von Codefragmenten dadurch vermieden werden, dass überlappende Codefragmente zu einem resultierenden Codefragment vereinigt werden.Farther the case may arise that after the implementation of the inventive method overlap resulting code fragments. Such an overlap especially occurs when a jump command is not the beginning referenced an already known code fragment, but subsequent commands referenced. This means that the beginning and / or End address of a code fragment inside another code fragment lies. This would lead to an incorrect result, which is not executable would. According to one Another embodiment of the invention, such an overlap of Code snippets are avoided by overlapping code snippets a resulting code fragment.
Schließlich kann der weitere Ausnahmefall eintreten, dass nach Durchführung des erfindungsgemäßen Verfahrens ein Codefragment im Inneren eine Einsprungadresse aufweist, welche von einem anderen Codefragment stammt. Eine solche, zwischen der Anfangs- und Endadresse des Codefragments liegende Einsprungadresse kann von einem im anderen Codefragment befindlichen Programmaufruf, z. B. einem CALL Befehl, oder von einem Sprungbefehl, z. B. einem JNE oder JMP Befehl, verursacht werden.Finally, can the further exceptional case occur that after completion of the inventive method a code fragment inside has an entry address which comes from another code fragment. Such, between the Start and end address of the code fragment lying entry address can be from a program call in the other code snippet, z. A CALL command, or a jump command, e.g. B. one JNE or JMP command, caused.
Gemäß einer besonders vorteilhaften Ausführung der Erfindung kann dies durch Berücksichtigung eines so genannten Adressen OFFSETs gelöst werden. Die im anderen Codefragment im jeweiligen Verzweigungsbefehl enthaltene absolute Einsprungadresse wird dann durch einen Bezug auf das Ziel Codefragment und einen den relativen Abstand zwischen der Anfangsadresse und der Einsprungadresse beschreibenden OFFSET berücksichtigt.According to one particularly advantageous embodiment The invention can do this by taking into account a so-called Addresses OFFSETs solved become. The code fragment in the other branch instruction in the respective branch instruction contained absolute entry address is then by a reference on the target code fragment and a the relative distance between the start address and the entry address descriptive OFFSET considered.
Weitere vorteilhafte Ausführungen der Erfindung sind in den Unteransprüchen angegeben. Die Erfindung und die weiteren Ausführungsformen werden an Hand der kurz angeführten Figuren nachfolgend näher erläutert. Dabei zeigenFurther advantageous embodiments The invention are specified in the subclaims. The invention and the other embodiments be on hand of the short listed Figures explained in more detail below. there demonstrate
Um die nachfolgenden Erläuterungen der in den Figuren dargestellten Ausführungsbeispiele zu vereinfachen, wurden Kurzbegriffe eingeführt. Hierbei gilt:
- – Die Nummern von Speicherzellen in einem Arbeitsspeicher, welche bei den in den Figuren dargestellten Beispielen achtstellige Hexadezimalzahlen darstellen, werden mit dem Begriff ADRESSE abgekürzt.
- – Die Anzahl der von einem Codefragment in einem Arbeitsspeicher belegten Speicherzellen wird mit dem Begriff LÄNGE abgekürzt
- – Die in Hexadezimalcode vorliegende Differenz zwischen einer, im Inneren eines Codefragments liegenden Einsprungadresse von einem anderen Codefragment und der Anfangsadresse des Codefragments wird mit dem Begriff OFFSET abgekürzt.
- - The numbers of memory cells in a random access memory, which represent eight-digit hexadecimal numbers in the examples shown in the figures, are abbreviated by the term ADDRESS.
- The number of memory cells occupied by a code fragment in a working memory is abbreviated by the term LENGTH
- - The difference in hexadecimal code between one, inside a code fragment the entry address of another code fragment and the start address of the code fragment is abbreviated by the term OFFSET.
Ein OFFSET = 0 bedeutet also, dass die Einsprungadresse in ein Codefragment mit der Anfangsadresse des Codefragments übereinstimmt. Dies ist der Normalfall nach Ablauf des erfindungsgemäßen Verfahrens.One OFFSET = 0 thus means that the entry address into a code fragment matches the start address of the code fragment. this is the Normal case after expiration of the method according to the invention.
Es
spielt dabei keine Rolle, an welcher Stelle sich der Befehl, welcher
diese Ein sprungsadresse aufweist, im Programmcode des aufrufenden
Codefragments befindet. Er kann sich also, wie aus den Beispielen der
So
zeigt
Die
Methode HELLO wird mit dem Programmaufruf
Falls
andererseits das Ergebnis des Vergleichs
In
So
beginnt die Methode in Zeile 1 mit der Anfangsadresse 1000100A in
hexadezimaler Codierung. Diese stellt eine Einsprungadresse dar.
Der dort geladene Sprungsbefehl JMP zweigt auf die Adresse 1001050 ab.
Dies ist auf der linken Seite des Programmlistings in
Falls
die Bedingung nicht erfüllt
ist, wird der Befehl JNE aktiv, unterbricht die weitere Bearbeitung
der folgenden Befehle, und setzt den Programmablauf bei der Adresse
1000107C fort. Dies ist auf der linken Seite des Programmlistings
in
Falls
dagegen mit den vorbereitenden Befehlen zwischen den Adressen 100001050
bis vor 1000106F festgestellt wird, dass die Bedingung a = 0 erfüllt ist,
wird der Befehl JNE nicht aktiv, und der Programmablauf wird mit
den auf die Adresse 1000106F folgenden Befehle fortgesetzt. Dabei
wird die Variable x entsprechend der Darstellung im Flussdiagramm
der
Wird
auf den in
Werden
nun gemäß dem erfindungsgemäßen Verfahren
Ketten von aufeinander folgenden, zur Runtime linear hintereinander
ausführbaren
Anweisungen im Programmcode zu Codefragmenten zusammengefasst, so
entstehen dabei drei Codefragmente 1, 2 und 3, welche in der
Im
Detail lassen sich diese Codefragmente durch folgende Werte beschreiben:
So beginnt das Codefragment 1 bei der Einsprungadresse 1000100A und endet unmittelbar darauf mit dem absoluten Sprungbefehl JMP bei 1000100E. Weiterhin beginnt das Codefragment 2 bei der Einsprungadresse 10001050, welche die Zieladresse des Sprungbefehls JMP ist, und endet mit dem weiteren Sprungbefehl JMP bei der Adresse 1000107B. Schließlich beginnt das Codefragment 3 bei der Einsprungadresse 1000107C, welche die Zieladresse des bedingten Sprungbefehls 1000106F ist, und endet bei der programmtechnischen Endebedingung RET bei der Adresse 1000108E.So Code fragment 1 starts at entry address 1000100A and immediately ends with the absolute jump command JMP 1000100E. Furthermore, the code fragment 2 starts at the entry address 10001050, which is the destination address of the branch instruction JMP, and ends with the further jump command JMP at address 1000107B. After all the code fragment 3 starts at the entry address 1000107C, which is the destination address of the conditional jump instruction 1000106F, and ends at the program end condition RET at the address 1000108E.
Diese
nach dem erfindungsgemäßen Verfahren
gebildeten Codefragmente sind in
Auf Grund des oben beschriebenen, bedingten Sprungbefehls JNE ist aber auch ein Programmablauf möglich, bei dem nur ein Teil des Codefragments 3 abgearbeitet wird, da im Codefragment 2 dieser Sprungsbefehl eine im Inneren des Codefragments 3 liegende Einsprungadresse bei 100010085 aufweist. Dieser Fall kann gemäß einer vorteilhaften, weiteren Ausführung der Erfindung am besten dadurch gelöst werden, dass hierzu bei Codefragment ein Offset berücksichtigt wird.On However, the reason for the conditional branch instruction JNE described above is also a program sequence possible, in which only a part of the code fragment 3 is processed, as in Code fragment 2 of this jump instruction one inside the code fragment 3 lying entry address at 100010085 has. This case can according to a advantageous, further embodiment the invention best be solved by this Code fragment considered an offset becomes.
Da
die Anfangsadresse des Codefragments 3 bei 1000107C und die ursprüngliche
Zieladresse des bedingten Sprungbefehls vor Durchführung der
erfindungsgemäßen Fragmentierung
bei 10001085 lag, bestimmt sich der relativer Adressabstand innerhalb
von Codefragment 3 für
den bedingten Sprung aus Codefragment 2, d. h. der Offset, wie folgt:
Die auf diese Weise gebildeten Codefragmente 1 bis 3, welche zu der Methode „HELLO" gehören, werden nun zusammen extrahiert und verschlüsselt und in einer Programmbibliothek hinterlegt, welche vorteilhaft wiederum selbst verschlüsselt ist.The Code fragments 1 to 3 formed in this way, which correspond to the Method "HELLO" belong now extracted and encrypted together and in a program library deposited, which in turn is advantageous itself encrypted.
So
beginnt diese Methode bei der Adresse 1000100A mit einem Programmaufruf
CALL, der auf die Adresse 10001010E verzweigt. Dies ist auf der
linken Seite des Programmlistings in
Nun wird der Programmcode mit den auf die Adresse 1000100A folgenden Befehlen fortgesetzt. Bei dieser Bearbeitung tritt bei der Adresse 10001010 ein weiterer Programmaufruf CALL auf, der auf die Adresse 1000101B verzweigt.Now the program code will follow with the address 1000100A Commands continued. In this editing occurs at the address 10001010 Another program call CALL on, the address 1000101B branched.
Dies
ist auf der linken Seite des Programmlistings in
Werden
nun gemäß dem erfindungsgemäßen Verfahren
wiederum Ketten von aufeinander folgenden, zur Runtime linear hintereinander
ausführbaren
Anweisungen im Programmcode zu Codefragmenten zusammengefasst, so
entstehen dabei drei Codefragmente 1, 2 und 3, welche in der
Im
Detail lassen sich diese Codefragmente durch folgende Werte beschreiben:
In
So beginnt das Codefragment 1 bei der Einsprungadresse 1000100A und endet mit der programmtechnischen Endebedingung RET bei der Adresse 10001016.So Code fragment 1 starts at entry address 1000100A and ends with the program-technical end condition RET at the address 10,001,016th
Weiterhin beginnt das Codefragment 2 bei der Einsprungadresse 1000101E, welche die Zieladresse des ersten Programmaufrufs CALL bei Adresse 1000100A ist, und endet mit der programmtechnischen Endebedingung RET bei der Adresse 10001020. Schließlich beginnt das Codefragment 3 bei der Einsprungadresse 1000101B, welche die Zieladresse des zweiten Programmaufrufs CALL bei der Adresse 10001010 ist, und endet ebenfalls mit der programmtechnischen Endebedingung RET bei der Adresse 10001020.Farther Code fragment 2 begins at the entry address 1000101E, which the destination address of the first program call CALL at address 1000100A is, and ends with the program end condition RET at the address 10001020. Finally the code fragment 3 starts at the entry address 1000101B, which the destination address of the second program call CALL at the address 10001010, and also ends with the program-technical end condition RET at the address 10001020.
Wie
aus
Nach
dieser Bildung der Codefragmente 1 und 2* ist wiederum aus
Gemäß der Darstellung
in
Die auf diese Weise gebildeten Codefragmente 1 und 2* werden schließlich separat verschlüsselt und in einer Programmbibliothek hinterlegt, welche vorteilhaft wiederum selbst verschlüsselt ist.The Code fragments 1 and 2 * formed in this way eventually become separate encoded and stored in a program library, which in turn advantageous even encrypted is.
Claims (14)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
DE200710059798 DE102007059798B3 (en) | 2007-12-11 | 2007-12-11 | Executable program code i.e. executable file, coding method for computer, involves combining chains of sequential instructions to code fragments, and coding and storing detected code fragments belonging to methods in program library |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
DE200710059798 DE102007059798B3 (en) | 2007-12-11 | 2007-12-11 | Executable program code i.e. executable file, coding method for computer, involves combining chains of sequential instructions to code fragments, and coding and storing detected code fragments belonging to methods in program library |
Publications (1)
Publication Number | Publication Date |
---|---|
DE102007059798B3 true DE102007059798B3 (en) | 2009-04-09 |
Family
ID=40418418
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
DE200710059798 Expired - Fee Related DE102007059798B3 (en) | 2007-12-11 | 2007-12-11 | Executable program code i.e. executable file, coding method for computer, involves combining chains of sequential instructions to code fragments, and coding and storing detected code fragments belonging to methods in program library |
Country Status (1)
Country | Link |
---|---|
DE (1) | DE102007059798B3 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105608345A (en) * | 2015-12-21 | 2016-05-25 | 上海华测导航技术股份有限公司 | Stm32 boot program encryption method |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040193987A1 (en) * | 1995-07-13 | 2004-09-30 | Sospita As | Protection of software code from unauthorized use by executing portions of the code in a secure computer environment separate from the environment that executes the remaining portions of the code |
-
2007
- 2007-12-11 DE DE200710059798 patent/DE102007059798B3/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040193987A1 (en) * | 1995-07-13 | 2004-09-30 | Sospita As | Protection of software code from unauthorized use by executing portions of the code in a secure computer environment separate from the environment that executes the remaining portions of the code |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105608345A (en) * | 2015-12-21 | 2016-05-25 | 上海华测导航技术股份有限公司 | Stm32 boot program encryption method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
DE60127310T2 (en) | DEVICE FOR PROTECTING DIGITAL DATA | |
DE102005021064B4 (en) | Method and apparatus for protection against buffer overrun attacks | |
DE102009041176B4 (en) | A compiler system and method for compiling a source code into an encrypted machine language code | |
DE102012212343A1 (en) | Distributed compilation process with command signature support | |
EP1798653B1 (en) | Method, computer program product and device for protecting a program comprising a function block | |
WO2015128301A1 (en) | Method for protecting a computer program from being influenced, and computer system | |
DE102007059798B3 (en) | Executable program code i.e. executable file, coding method for computer, involves combining chains of sequential instructions to code fragments, and coding and storing detected code fragments belonging to methods in program library | |
WO2004114131A1 (en) | Method for booting up a software in the boot sector of a programmable read-only memory | |
EP2394232B1 (en) | Device and method for preventing unauthorized use and/or manipulation of software | |
DE10002203B4 (en) | Method for protecting a microcomputer system against manipulation of data stored in a memory arrangement of the microcomputer system | |
WO2016169646A1 (en) | System and method for monitoring the integrity of a component delivered by a server system to a client system | |
DE102005046696B4 (en) | A method for generating protected program code and method for executing program code of a protected computer program and computer program product | |
EP2302554A2 (en) | Method for identifying a section of computer program contained in a computer storage system | |
WO2006119928A1 (en) | Method for adding functionality to an executable first module of a program package | |
EP1892639B1 (en) | Secure program code execution | |
EP3588340B1 (en) | Computer-implemented method for operating a data storage device | |
DE102006035662A1 (en) | Monitoring correct operation of data processing unit, displaces subsystem from allowed state into non-allowed state before executing partial operational run | |
WO2021170316A1 (en) | Analysis of a container instance of an operating system | |
DE10357032A1 (en) | Method for reloading software in the boot sector of a programmable read only memory | |
EP1318451B1 (en) | Method to execute a program on a computer | |
WO2006063876A1 (en) | Method and device for encoding and for carrying out a software library | |
DE102004047191A1 (en) | Tamper-proof microprocessor system and operating method therefor | |
DE102004008180A1 (en) | Secure operating method for a portable data carrier, especially a chip card, in which operating parameter values are checked during a memory access or data output process to see if their values have been changed | |
DE102021212994B3 (en) | Method for detecting anomalies indicating tampering during a secure boot process of a software-controlled device | |
DE102017208199A1 (en) | Arithmetic unit and operating method for a computing unit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
8364 | No opposition during term of opposition | ||
R119 | Application deemed withdrawn, or ip right lapsed, due to non-payment of renewal fee | ||
R079 | Amendment of ipc main class |
Free format text: PREVIOUS MAIN CLASS: G06F0021220000 Ipc: G06F0021100000 |