cgi-bin 을 이용하여 서버에 루트권한으로 실행

· 13년 전 · 2144
 
1. g++ 을 이용하여 파일하나를 만든다.

suexec.cpp

#include <stdlib.h>

using namespace std;

int main()
{
     system("cd /var/www/html; ./print.py");
     return 0;
}


g++ -o setuid.do suexec.cpp
chmod 4755 setuid.do
cgi-bin 디렉토리로 setuid.do 이동시킨다.

print.py

#!/usr/bin/env python

import os

#for html view
print "Content-Type: text/planin\n\n"

os.system("mkdir byoungguk")
print "byoungguk directory create ok"



서버에 확인하면 정상적으로 디렉토리가 생성이 되어 있다.
|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
Linux 13년 전 조회 1,766
jQuery 13년 전 조회 3,325
Linux 13년 전 조회 1,501
Linux 13년 전 조회 1,604
Linux 13년 전 조회 1,760
Linux 13년 전 조회 2,207
Linux 13년 전 조회 1,958
jQuery 13년 전 조회 2,307
기타 13년 전 조회 2,773
jQuery 13년 전 조회 3,418
PHP 13년 전 조회 1,881
jQuery 13년 전 조회 8,429
Linux 13년 전 조회 2,716
Linux 13년 전 조회 1,596
Linux 13년 전 조회 2,145
Linux 13년 전 조회 2,054
Linux 13년 전 조회 2,328
Linux 13년 전 조회 1,500
JavaScript 13년 전 조회 2,937
Linux 13년 전 조회 3,262
Linux 13년 전 조회 1,711
Linux 13년 전 조회 1,804
Linux 13년 전 조회 2,148
Linux 13년 전 조회 4,530
Linux 13년 전 조회 1,776
Linux 13년 전 조회 1,956
Linux
[Linux]
13년 전 조회 1,853
Linux 13년 전 조회 1,674
Linux 13년 전 조회 2,148
Linux 13년 전 조회 2,910