    {"id":1105,"date":"2021-08-12T03:56:09","date_gmt":"2021-08-12T03:56:09","guid":{"rendered":"http:\/\/student-activity.binus.ac.id\/csc\/?p=1105"},"modified":"2021-08-12T03:56:09","modified_gmt":"2021-08-12T03:56:09","slug":"binary-patching-menggunakan-ida-pro-part-1","status":"publish","type":"post","link":"https:\/\/student-activity.binus.ac.id\/csc\/2021\/08\/binary-patching-menggunakan-ida-pro-part-1\/","title":{"rendered":"Binary Patching menggunakan IDA Pro (part 1)"},"content":{"rendered":"<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Halo Folks~ selamat datang kembali di artikel tutorial CSC. Pada kali ini, yang akan kita bahas adalah tutorial bagaimana melakukan <\/span><span style=\"font-weight: 400\"><em>Patching<\/em> <\/span><span style=\"font-weight: 400\">sederhana pada sebuah program menggunakan software disassembler Ida Pro. Artikel ini ditujukan buat kamu-kamu semua yang mungkin tertarik pada <\/span><em><span style=\"font-weight: 400\">Reverse Engineering<\/span><\/em><span style=\"font-weight: 400\"> dan ingin belajar bagaimana dasarnya melakukan <\/span><em><span style=\"font-weight: 400\">Patching<\/span><\/em><span style=\"font-weight: 400\">. <\/span><em><span style=\"font-weight: 400\">So<\/span><\/em><span style=\"font-weight: 400\">, sebelum kita mulai mari kita pelajari apa arti <em>patching <\/em>dan apa itu IDA terlebih dahulu.<\/span><\/p>\n<p style=\"text-align: justify\"><b>Apa itu Patching?<\/b><\/p>\n<p style=\"text-align: justify\"><em><span style=\"font-weight: 400\">Binary Patching<\/span><\/em><span style=\"font-weight: 400\"> atau biasa disebut <\/span><em><span style=\"font-weight: 400\">Patching<\/span><\/em><span style=\"font-weight: 400\">, adalah sebuah proses memodifikasi <\/span><em><span style=\"font-weight: 400\">byte-byte<\/span><\/em><span style=\"font-weight: 400\"> atau <\/span><em><span style=\"font-weight: 400\">assembly<\/span> <span style=\"font-weight: 400\">instruction<\/span><\/em><span style=\"font-weight: 400\"> yang terdapat pada sebuah program executable (ELF, .exe, dsb.) ketika dijalankan. Sederhananya, <\/span><span style=\"font-weight: 400\"><em>Patching<\/em> <\/span><span style=\"font-weight: 400\">memungkinkan kita untuk melakukan perubahan terhadap nilai-nilai variabel yang ada di dalam sebuah program.<\/span><\/p>\n<p style=\"text-align: justify\"><b>Apa itu IDA?<\/b><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">IDA (<\/span><em><span style=\"font-weight: 400\">Interactive Data Assembler<\/span><\/em><i><span style=\"font-weight: 400\">)<\/span><\/i><span style=\"font-weight: 400\"> adalah sebuah <\/span><span style=\"font-weight: 400\"><em>tool<\/em> <\/span><span style=\"font-weight: 400\">yang mampu membongkar sebuah <\/span><em><span style=\"font-weight: 400\">Compiled Executable<\/span><\/em><span style=\"font-weight: 400\"> dan memaparkannya dalam bentuk <\/span><em><span style=\"font-weight: 400\">Assembly Code<\/span><\/em><span style=\"font-weight: 400\">. Sementara IDA Pro adalah versi premium\/berbayar dari IDA, dengan fitur yang lebih banyak dan khususnya mampu meng-<\/span><em><span style=\"font-weight: 400\">generate <\/span><\/em><span style=\"font-weight: 400\"><em>Pseudocode<\/em> <\/span><span style=\"font-weight: 400\">dari program tersebut sehingga lebih mudah dibaca manusia. Software ini merupakan salah satu yang paling sering digunakan dalam proses <\/span><em><span style=\"font-weight: 400\">Reverse Engineering<\/span><\/em><span style=\"font-weight: 400\"> karena memiliki banyak fitur berguna seperti <\/span><em><span style=\"font-weight: 400\">Decompiling<\/span><\/em><i><span style=\"font-weight: 400\">, <\/span><\/i><span style=\"font-weight: 400\">membaca alur program, <\/span><em><span style=\"font-weight: 400\">debugging<\/span><\/em><span style=\"font-weight: 400\">, dan yang akan kita bahas setelah ini, yaitu <\/span><em><span style=\"font-weight: 400\">patching<\/span><\/em><i><span style=\"font-weight: 400\">.<\/span><\/i><\/p>\n<p style=\"text-align: justify\"><b>Patching Variabel Integer menggunakan IDA Pro<\/b><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Untuk percobaan <\/span><em><span style=\"font-weight: 400\">Patching<\/span><\/em><span style=\"font-weight: 400\"> ini, saya sudah menyiapkan sebuah kodingan bahasa C yang saya compile menggunakan gcc menjadi format ELF (Executable and Linkable Format) dengan command:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">gcc script.c -o percobaan<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Source Code:<\/span><\/p>\n<pre style=\"text-align: justify\"><span style=\"font-weight: 400\">#include<\/span> <span style=\"font-weight: 400\">&lt;stdio.h&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400\">#include<\/span> <span style=\"font-weight: 400\">&lt;string.h&gt;<\/span>\r\n\r\n\r\n\r\n\r\n<span style=\"font-weight: 400\">int<\/span> <span style=\"font-weight: 400\">main<\/span><span style=\"font-weight: 400\">(){<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400\">int<\/span> <span style=\"font-weight: 400\">angkanya<\/span><span style=\"font-weight: 400\"> = <\/span><span style=\"font-weight: 400\">5<\/span><span style=\"font-weight: 400\">;<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400\">printf<\/span><span style=\"font-weight: 400\">(<\/span><span style=\"font-weight: 400\">\"selamat datang di tes ngepatching.<\/span><span style=\"font-weight: 400\">\\n<\/span><span style=\"font-weight: 400\">\"<\/span><span style=\"font-weight: 400\">);<\/span>\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400\">printf<\/span><span style=\"font-weight: 400\">(<\/span><span style=\"font-weight: 400\">\"angkanya adalah: <\/span><span style=\"font-weight: 400\">%d<\/span><span style=\"font-weight: 400\">\\n<\/span><span style=\"font-weight: 400\">\"<\/span><span style=\"font-weight: 400\">, <\/span><span style=\"font-weight: 400\">angkanya<\/span><span style=\"font-weight: 400\">);<\/span>\r\n\r\n\r\n\r\n\r\n<span style=\"font-weight: 400\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400\">return<\/span> <span style=\"font-weight: 400\">0<\/span><span style=\"font-weight: 400\">;<\/span>\r\n\r\n<span style=\"font-weight: 400\">}<\/span><\/pre>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Compile &amp; Output:\u00a0<\/span><\/p>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1106\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/2-2.png\" alt=\"\" width=\"361\" height=\"156\" \/><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Sederhana sekali bukan? Kodingan ini hanya melakukan <\/span><em><span style=\"font-weight: 400\">print <\/span><\/em><span style=\"font-weight: 400\"><em>variabel<\/em> \u201cangkanya\u201d yang berisi nilai yang sudah ditentukan sebelumnya, yaitu 5. Nah, yang mau dilakukan sekarang adalah kita ingin mencoba mengubah nilai \u201cangkanya\u201d yang tadinya 5 menjadi nilai lain, misalnya 21 menggunakan teknik <\/span><em><span style=\"font-weight: 400\">patching<\/span><\/em><span style=\"font-weight: 400\">.<\/span><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Pertama-tama kita jalankan dulu IDA Pro nya, lalu klik New dan cari di mana file yang mau di-<\/span><em><span style=\"font-weight: 400\">Patch<\/span><\/em><span style=\"font-weight: 400\"> berada (program yang sudah di-<\/span><em><span style=\"font-weight: 400\">compile<\/span><\/em><span style=\"font-weight: 400\"> ya, bukan <\/span><em><span style=\"font-weight: 400\">source<\/span><\/em><span style=\"font-weight: 400\"><em> code<\/em>-nya).<\/span><\/p>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1107\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/3-2.png\" alt=\"\" width=\"512\" height=\"168\" \/><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Lalu load <\/span><i><span style=\"font-weight: 400\">file-<\/span><\/i><span style=\"font-weight: 400\">nya dalam bentuk ELF64 seperti di gambar, setelah itu tunggu hingga dia selesai loading.<\/span><\/p>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1108\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/4-2.png\" alt=\"\" width=\"512\" height=\"288\" \/><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Setelah itu, tampilannya akan berubah menjadi seperti ini. Pada bagian ini kita sudah bisa melihat alur program dalam bentuk <\/span><em><span style=\"font-weight: 400\">graph\/text<\/span><\/em><span style=\"font-weight: 400\"> yang isinya <\/span><em><span style=\"font-weight: 400\">instruction-instruction<\/span><\/em><span style=\"font-weight: 400\"> dalam bahasa <\/span><em><span style=\"font-weight: 400\">Assembly<\/span><\/em><span style=\"font-weight: 400\">.<\/span><\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1109\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/5-1.png\" alt=\"\" width=\"512\" height=\"288\" \/><span style=\"font-weight: 400\">dalam bentuk graph<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1110\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/6.jpg\" alt=\"\" width=\"512\" height=\"288\" \/><span style=\"font-weight: 400\">Dalam bentuk text (klik kanan-&gt;text view)<\/span><\/p>\n<pre style=\"text-align: justify\"><span style=\"font-weight: 400\">.text:000000000000114D mov [rbp+var_4], <\/span><span style=\"font-weight: 400\">5<\/span><\/pre>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Pada <\/span><span style=\"font-weight: 400\"><em>Instruction<\/em> <\/span><span style=\"font-weight: 400\">tersebut, kita bisa melihat angka 5 seperti nilai variabel \u201cangkanya\u201d di <\/span><em><span style=\"font-weight: 400\">source code<\/span><\/em><span style=\"font-weight: 400\">, yang menandakan bahwa nilai 5 di-<\/span><em><span style=\"font-weight: 400\">store<\/span><\/em><span style=\"font-weight: 400\"> ke dalam memori program melalui <\/span><span style=\"font-weight: 400\"><em>instruction<\/em> <\/span><span style=\"font-weight: 400\">tersebut. Untuk mengubah nilainya, tinggal <\/span><span style=\"font-weight: 400\"><em>select<\/em> <\/span><span style=\"font-weight: 400\">angka 5 nya, lalu ke tab <\/span><em><span style=\"font-weight: 400\">Edit-&gt;Patch Program-&gt;Change byte<\/span><span style=\"font-weight: 400\">.<\/span><\/em><\/p>\n<p style=\"text-align: justify\"><em><span style=\"font-weight: 400\"> <img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1111\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/7.jpg\" alt=\"\" width=\"512\" height=\"288\" \/><\/span><\/em><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Maka akan muncul <\/span><em><span style=\"font-weight: 400\">Pop-up<\/span><\/em><span style=\"font-weight: 400\"> seperti di gambar.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1112\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/8-1.png\" alt=\"\" width=\"512\" height=\"180\" \/><\/p>\n<p style=\"text-align: justify\"><em><span style=\"font-weight: 400\">Value <\/span><span style=\"font-weight: 400\">bytes<\/span><\/em><span style=\"font-weight: 400\">-nya akan ditampilkan dalam bentuk <\/span><em><span style=\"font-weight: 400\">Hexadecimal<\/span><\/em><span style=\"font-weight: 400\">, dan kita bisa melihat nilai 05 00 00 00 dimana 05 adalah nilai hex dari 5. Karena kita ingin mengubahnya menjadi 21 yang mempunyai nilai hex 15, maka tinggal kita ubah bagian 05 00 00 00 menjadi 15 00 00 00.\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1113\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/9-1.png\" alt=\"\" width=\"512\" height=\"175\" \/><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Setelah itu klik ok dan lihat perubahannya.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1114\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/10.jpg\" alt=\"\" width=\"512\" height=\"288\" \/><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\"><em>Instruction<\/em> <\/span><span style=\"font-weight: 400\">yang tadinya <\/span><strong>mov [rbp+var_4], 5 <\/strong><span style=\"font-weight: 400\">sekarang telah berubah menjadi <\/span><em><span style=\"font-weight: 400\">instruction <\/span><span style=\"font-weight: 400\">\u00a0<\/span><\/em><strong>mov [rbp+var_4], 15<\/strong><span style=\"font-weight: 400\"> (15h artinya 21 dalam <\/span><em><span style=\"font-weight: 400\">decimal<\/span><\/em><span style=\"font-weight: 400\">). Kita sudah mengubah nilainya, sekarang kita recompile lagi menjadi ELF dengan <\/span><em><span style=\"font-weight: 400\">byte<\/span><\/em><span style=\"font-weight: 400\"> yang sudah diubah. Caranya dengan klik tab <\/span><em><span style=\"font-weight: 400\">Edit-&gt;Patch program-&gt;Apply patches to input file<\/span><\/em><span style=\"font-weight: 400\"><em>.<\/em>\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1115\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/11-1.png\" alt=\"\" width=\"512\" height=\"288\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1116\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/12-1.png\" alt=\"\" width=\"512\" height=\"269\" \/><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Nah, setelah keluar <\/span><em><span style=\"font-weight: 400\">pop-up<\/span><\/em><span style=\"font-weight: 400\"> seperti ini kita tinggal klik OK dan file program yang kita masukkan tadi akan ter-<\/span><em><span style=\"font-weight: 400\">overwrite<\/span><\/em><span style=\"font-weight: 400\"> dengan program baru yang sudah kita <\/span><em><span style=\"font-weight: 400\">patch<\/span><\/em><span style=\"font-weight: 400\">. Atau kita bisa meng-<\/span><em><span style=\"font-weight: 400\">checklist <\/span><\/em><i><span style=\"font-weight: 400\">\u201c<\/span><\/i><em><span style=\"font-weight: 400\">Create Backup<\/span><\/em><i><span style=\"font-weight: 400\">\u201d<\/span><\/i><span style=\"font-weight: 400\"> jika tidak mau file yang lama ter-<\/span><em><span style=\"font-weight: 400\">overwrite<\/span><\/em><span style=\"font-weight: 400\"> dengan yang baru.<\/span><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Setelah itu, tinggal kita <\/span><em><span style=\"font-weight: 400\">run <\/span><\/em><span style=\"font-weight: 400\">dan bandingkan outputnya.<\/span><\/p>\n<p style=\"text-align: justify\"><em><span style=\"font-weight: 400\">Before Patch:<\/span><\/em><\/p>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1117\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/13-1.png\" alt=\"\" width=\"349\" height=\"70\" \/><\/p>\n<p style=\"text-align: justify\"><em><span style=\"font-weight: 400\">After Patch<\/span><\/em><i><span style=\"font-weight: 400\">:<\/span><\/i><\/p>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1118\" src=\"http:\/\/student-activity.binus.ac.id\/csc\/wp-content\/uploads\/sites\/37\/2021\/08\/14.png\" alt=\"\" width=\"351\" height=\"75\" \/><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Yak, dari <\/span><em><span style=\"font-weight: 400\">output-<\/span><\/em><span style=\"font-weight: 400\">nya kita sudah bisa melihat bahwa variabel \u201cangkanya\u201d yang kita print sudah berubah nilai dari 5 menjadi 21. Selamat, kita sudah berhasil melakukan <\/span><em><span style=\"font-weight: 400\">Patching<\/span><\/em><span style=\"font-weight: 400\">.<\/span><\/p>\n<p style=\"text-align: justify\"><span style=\"font-weight: 400\">Yah, kira-kira itu saja langkah-langkah dasar untuk <\/span><em><span style=\"font-weight: 400\">Binary Patching<\/span><\/em><span style=\"font-weight: 400\">. Untuk part-part selanjutnya kita akan mengupas lebih dalam tentang <\/span><em><span style=\"font-weight: 400\">Patching<\/span><\/em><span style=\"font-weight: 400\"> dan hal-hal apalagi yang bisa kita <\/span><em><span style=\"font-weight: 400\">Patching<\/span><\/em><span style=\"font-weight: 400\">-in. <\/span><i><span style=\"font-weight: 400\">So<\/span><\/i><span style=\"font-weight: 400\">, terima kasih sudah membaca dan tunggu artikel-artikel kami berikutnya :D.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Halo Folks~ selamat datang kembali di artikel tutorial CSC. Pada kali ini, yang akan kita bahas adalah tutorial bagaimana melakukan Patching sederhana pada sebuah program menggunakan software disassembler Ida Pro. Artikel ini ditujukan buat kamu-kamu semua yang mungkin tertarik pada Reverse Engineering dan ingin belajar bagaimana dasarnya melakukan Patching. So, sebelum kita mulai mari kita [&hellip;]<\/p>\n","protected":false},"author":42,"featured_media":1119,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1105","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles"],"_links":{"self":[{"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/posts\/1105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/comments?post=1105"}],"version-history":[{"count":2,"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/posts\/1105\/revisions"}],"predecessor-version":[{"id":1121,"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/posts\/1105\/revisions\/1121"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/media\/1119"}],"wp:attachment":[{"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/media?parent=1105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/categories?post=1105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/student-activity.binus.ac.id\/csc\/wp-json\/wp\/v2\/tags?post=1105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}