ANTICHAT.XYZ    VIDEO.ANTICHAT.XYZ    НОВЫЕ СООБЩЕНИЯ    ФОРУМ  
Баннер 1   Баннер 2
Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей. Здесь обсуждаются безопасность, программирование, технологии и многое другое. Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
Вернуться   Форум АНТИЧАТ > Оффтоп > Forum for discussion of ANTICHAT
   
Ответ
 
Опции темы Поиск в этой теме Опции просмотра

mysql doubt
  #1  
Старый 13.06.2008, 12:40
Аватар для Americandream
Americandream
Новичок
Регистрация: 12.06.2008
Сообщений: 17
Провел на форуме:
40852

Репутация: 12
По умолчанию mysql doubt

recently i started making a pentest to a webserver using fedora, running squirremail,apache,php and mysql, i found an sql injection vulnerability, which i quick try to explore, i found that mysql was version 5.0.27 and it was running as root, therefore i was able to use load_file and outfile, i verify too that i have access to information_schema, after i grab all tables, i grab some interesting data, username and hashs, after this i tryed connect to webserver via web interface, ssh and mysql, for upload shell, all without sucess =(. i tryed outfile shell to public var of www but i obtain error because i dont have permissions, but i verify that i can outfile to /tmp and load_file with sucess, but this is useless since load_file return a string and i cant access shell on /tmp dir via include vulnerabilities. so i get tired and start think in other ways of obtain local access to that machine, i load_file httpd.conf for obtain vhost list to look for login pages data of forums or blogs to later upload shell. i get some interesting data but unfortunately some files dont have permissions, like some pages of vhosts and .htaccess files.
this is part of what i got
Цитата:
EDIT: all hashs cracked
so, about the mysql, my questions are:

1)i can load_file /etc/passwd and some *.php files but unfornately im unable to load_file some files like .htaccess and *php of some vhosts, this happen because its related to that file permissions or file_priv?

2)since i cannot read all content of a file, does load_file have limit of size when load files? how can i bypass this?

3)its possible using outfile when magic_quotes are on? because i tryed this on other machines using char, hex encoding and none of this worked, there is any solution for this?

4)for got the tables i use
select null,table_name,null from information_schema.tables, what should i use to get the columns?


5)its possible updating the content of a field, for later when page displayed execute php code?


help will be appreciated, regards.

Последний раз редактировалось Americandream; 18.06.2008 в 05:32..
 
Ответить с цитированием

  #2  
Старый 13.06.2008, 13:35
Аватар для Piflit
Piflit
Banned
Регистрация: 11.08.2006
Сообщений: 1,522
Провел на форуме:
5128756

Репутация: 2032


Отправить сообщение для Piflit с помощью ICQ
По умолчанию

Цитата:
for got the tables i use
select null,table_name,null from information_schema.tables, what should i use to get the columns?
use smth like that
select+1,column_name,3,4,5+from+information_schema .columns+where+table_name=0xtable_name_in_hex+limi t+0,1/*
 
Ответить с цитированием

  #3  
Старый 16.06.2008, 11:10
Аватар для Americandream
Americandream
Новичок
Регистрация: 12.06.2008
Сообщений: 17
Провел на форуме:
40852

Репутация: 12
По умолчанию

thanks for the quick answer =)
if possible, clarify the other questions.


Цитата:
Сообщение от Americandream  
1)i can load_file /etc/passwd and some *.php files but unfornately im unable to load_file some files like .htaccess and *php of some vhosts, this happen because its related to that file permissions or file_priv?
i discovered that i was unable to outfile due to directory permissions, fortunately i obtained a directory with permissions and this solve my problem.
so, if possible try give solution for the other questions.
thanks.

Последний раз редактировалось Дрэгги; 16.06.2008 в 16:50..
 
Ответить с цитированием

  #4  
Старый 17.06.2008, 20:08
Аватар для [Raz0r]
[Raz0r]
Members of Antichat - Level 5
Регистрация: 25.02.2007
Сообщений: 495
Провел на форуме:
3244717

Репутация: 1980
Отправить сообщение для [Raz0r] с помощью ICQ
По умолчанию

Цитата:
i can load_file /etc/passwd and some *.php files but unfornately im unable to load_file some files like .htaccess and *php of some vhosts, this happen because its related to that file permissions or file_priv?
it is definitely related to the file permissions; as a rule, if file_priv is turned on only file permissions restrict an attacker

Цитата:
since i cannot read all content of a file, does load_file have limit of size when load files? how can i bypass this?
yes, load_file has a size limit which is defined by max_allowed_packet variable
More info:
LOAD_FILE
max_allowed_packet

Цитата:
its possible using outfile when magic_quotes are on? because i tryed this on other machines using char, hex encoding and none of this worked, there is any solution for this?
unfortunately, it is not possible, into_outfile accepts only a value between quotes.
More info:
INTO OUTFILE

Цитата:
its possible updating the content of a field, for later when page displayed execute php code?
it depends on a certain web application; if it is prone to a php-include vulnerability so that web-app gets data from database and executes it then you can modify some fields and as a result you'll get a web-shell. However that is very rare situation. It happens much more often when you have a sql-injection where one of the columns is supposed to be opened as a file, and sometimes to be included as script. The latter is also rare
 
Ответить с цитированием

  #5  
Старый 17.06.2008, 21:13
Аватар для Americandream
Americandream
Новичок
Регистрация: 12.06.2008
Сообщений: 17
Провел на форуме:
40852

Репутация: 12
По умолчанию

thanks so much for the answers, so just one more doubt left
Цитата:
Writing info into files without single quotes: (example)

SELECT password FROM tablename WHERE username =
CONCAT(CHAR(39),CHAR(97),CHAR(100),CHAR(109),CHAR( 105),CHAR(110),CHAR( 39)) INTO
OUTFILE CONCAT(CHAR(39),CHAR(97),CHAR(100),CHAR(109),CHAR( 105),CHAR(110),CHAR(
39))

Note: You must specify a new file, it may not exist! and give the correct
pathname!
this will not work?
 
Ответить с цитированием

  #6  
Старый 17.06.2008, 21:20
Аватар для [Raz0r]
[Raz0r]
Members of Antichat - Level 5
Регистрация: 25.02.2007
Сообщений: 495
Провел на форуме:
3244717

Репутация: 1980
Отправить сообщение для [Raz0r] с помощью ICQ
По умолчанию

no, that won't work, as i've already said into outfile requires the quotes. And why do you use CONCAT after WHERE? You should just use the sequence of ASCII-codes in the CHAR() function, i.e.:
CHAR(39,97,100,109,105,110,39)
 
Ответить с цитированием

  #7  
Старый 18.06.2008, 05:25
Аватар для Americandream
Americandream
Новичок
Регистрация: 12.06.2008
Сообщений: 17
Провел на форуме:
40852

Репутация: 12
По умолчанию

look, i just quote that text from here forum.antichat.ru/thread61678-mysql+cheat.html
so definitely is wrong.
 
Ответить с цитированием

  #8  
Старый 18.06.2008, 19:17
Аватар для [Raz0r]
[Raz0r]
Members of Antichat - Level 5
Регистрация: 25.02.2007
Сообщений: 495
Провел на форуме:
3244717

Репутация: 1980
Отправить сообщение для [Raz0r] с помощью ICQ
По умолчанию

Цитата:
look, i just quote that text from here forum.antichat.ru/thread61678-mysql+cheat.html
the author of that thread wanted to say that the material given in it didn't correspond to the facts. You could guess this idea if you knew Russian =)
 
Ответить с цитированием

  #9  
Старый 21.06.2008, 13:48
Аватар для Americandream
Americandream
Новичок
Регистрация: 12.06.2008
Сообщений: 17
Провел на форуме:
40852

Репутация: 12
По умолчанию

all problems solved.
thanks Piflit and [Raz0r]
 
Ответить с цитированием

  #10  
Старый 03.07.2008, 09:13
Аватар для Scipio
Scipio
Members of Antichat - Level 5
Регистрация: 02.11.2006
Сообщений: 781
Провел на форуме:
5939734

Репутация: 1917


Отправить сообщение для Scipio с помощью ICQ
По умолчанию

Цитата:
its possible using outfile when magic_quotes are on? because i tryed this on other machines using char, hex encoding and none of this worked, there is any solution for this?
sometimes this is possible
I described it here:
http://forum.antichat.ru/showpost.ph...5&postcount=39
this is a script for convenience:
http://forum.antichat.ru/showpost.ph...3&postcount=54
__________________
Карфаген должен быть разрушен...
 
Ответить с цитированием
Ответ



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Эффективные Слепые Иньекции Евгений Минаев Авторские статьи 10 31.05.2008 09:43
2 mysql на разных портах + phpmyadmin MicRO Soft - *nix 0 04.01.2008 00:06
Общие Рекомендации Защиты (MySQL и SQL Web-интерфейс) k00p3r Чужие Статьи 0 13.06.2005 11:22
Защищаем MySql. Шаг за шагом k00p3r Чужие Статьи 0 13.06.2005 11:18
SQL инъекция в сервере MySQL k00p3r Чужие Статьи 0 12.06.2005 12:41



Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT.XYZ