Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 05-26-2013, 02:27 AM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Programming › C / C++ v
« Previous 1 ... 6 7 8 9 10 ... 15 Next »

modifikasi WP bit pada register cr0 di mesin x86

Home General Computer Multimedia Business Lounge

Post Reply 
Tweet
Threaded Mode | Linear Mode
modifikasi WP bit pada register cr0 di mesin x86
02-14-2012, 12:38 AM
Post: #1
ev1lut10n Offline
./Devilz Officer
Posts: 239
Joined: Aug 2011
Reputation: 82
modifikasi WP bit pada register cr0 di mesin x86
modifikasi WP bit pada register cr0 di mesin x86

by: ev1lut10n

"there's a sleeping monster when he got his old skills he's a real monster"

Setelah sekian lama bermasalah akhirnya baru bisa online hari ini. oleh karena itu akan kita mulai kembali permainan kita
yang tertunda tentang wp bit pada register cr0.

cr0 merupakan register kontrol pada x86. WP bit pada cr0 akan menentukan apakah kita bisa melakukan write pada pages
yang bertanda read only atau tidak, untuk bisa melakukan write kita harus mengeset wp bit pada cr0.

Untuk mengetahui wp bit pada register cr0 bisa menggunakan read_cr0 di sini kita bisa melihat penggunaan PVOP_CALL0 pada read_cr0
/usr/include/asm/paravirt.h:
==========
static inline unsigned long read_cr0(void)
{
return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr0);
}
=========

sedangkan untuk mengeset bit cr0 menjadi unprotected bisa dengan write_cr0
=============
static inline void write_cr0(unsigned long x)
{
PVOP_VCALL1(pv_cpu_ops.write_cr0, x);
}
================

berikut ini contoh penggunaan read_cr0

read_cr0.c
===================
/**read_cr0 test by ev1lut10n**/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/errno.h>
#include <linux/mm.h>
#include <asm/unistd.h>
int readcr0test()
{
unsigned long cr0;
cr0 = read_cr0();
printk("\n%lu",cr0);
return 0;
}

int init_module (void)
{
readcr0test();
return 0;
}


void cleanup_module (void)
{
return 0;
}
================================

Makefile
=======
obj-m += read_cr0.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clea
==========


berikut ini adalah potongan kode asm yang digunakan untuk memodifikasi wp bit pada register cr0 yang akan kita jalankan di kernel space

=============================
__asm__ ("push %eax\n\t"
"mov %cr0,%eax\n\t"
"and $0x0FFFEFFFF,%eax\n\t"
"mov %eax, %cr0\n\t"
"pop %eax");
============

here we go:
modify_cr0.c:
============
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/module.h>
static int ev1ls_cr0()
{
//ev1l's bypass cr0 trick();
asm volatile("push %eax\n\t"
"mov %cr0,%eax\n\t"
"and $0x0FFFEFFFF,%eax\n\t"
"mov %eax, %cr0\n\t"
"pop %eax");
return 0;
}

void readcr0test()
{
unsigned long cr0;
cr0 = read_cr0();
printk("\n%lu",cr0);
printk("\n%X",cr0);
}

int init_module (void)
{
readcr0test();
ev1ls_cr0();
readcr0test();
return 0;
}

void cleanup_module (void)
{
return 0;
}
============

Makefile:
=======
obj-m += modify_cr0.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clea

=============
Find all posts by this user
Quote this message in a reply
02-17-2012, 06:12 PM
Post: #2
ack_attack Offline
adiknya syn-attack
Posts: 27
Joined: Feb 2012
Reputation: 13
RE: modifikasi WP bit pada register cr0 di mesin x86
ijin belajar kakak mywisdom....... terimakasih kakak atas bahan pembelajarannya... hore
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Rainbow [Tutor] membuat project pada visual studio c++ qball006_error 7 177 11-04-2012 02:17 PM
Last Post: qball006_error
  Sekilas VFS pada linux kernel 2.4 ev1lut10n 2 508 07-14-2012 09:44 PM
Last Post: cbrnewbie
  [SHARE] jenis fungsi pada bahasa C dan C++ syn_attack 4 1,362 12-17-2011 12:03 AM
Last Post: akhew_jr

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 05-26-2013, 02:27 AM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE