Git Product home page Git Product logo

allendisk's Introduction

Allen Disk

Allen Disk 是一個強大、免費、開源的雲端硬碟,有了 Allen Disk,你將可以擁有自己的網路硬碟,甚至開放註冊帳號,給大家當作免空。 Allen Disk 配有檔案加密儲存、外連檔案、線上預覽、分享資料夾等等功能,讓你輕鬆管理你的檔案或是分享給大家一起使用。 http://ad.allenchou.cc

allendisk's People

Contributors

s3131212 avatar koru1130 avatar

Stargazers

Jacky Lam avatar tiwb avatar nunonuno avatar Poren Chiang avatar HungDino avatar Kvar Izunia avatar Hsuan avatar Jason Kwok avatar 小克 avatar 施承儒 avatar  avatar b0ring avatar Tony Yang avatar richegg Tsai avatar Ming Tsay avatar Geoffrey Cheung avatar Yami Odymel avatar Tsundere Chen avatar gnehs avatar Denny Huang avatar 尤理衡 (Li-Heng Yu) avatar Babywbx avatar Light avatar Kais avatar Secret avatar Jack KC Chan avatar  avatar Frank Sung avatar  avatar Angus H. avatar Ting Shao avatar Zack avatar Ping-yu Chou avatar Benny Ling avatar Emik avatar Lewis avatar Henry Wu avatar  avatar

Watchers

James Cloos avatar Secret avatar Ian avatar  avatar  avatar Ping-yu Chou avatar Henry Wu avatar  avatar

allendisk's Issues

CSRF Vulnerability in /admin/setting.php

/admin/setting.php

if ($_SESSION['alogin']) {
    if (isset($_GET['set']) && $_GET['set'] == 'set') {
        $db->update('setting', array('value' => $_POST['sitename']), array('name' => 'sitename'));
        $db->ExecuteSQL(sprintf("UPDATE `setting` SET `value` = '%s' WHERE `setting`.`name` = 'sitetitle';", $db->databaseLink->real_escape_string($_POST['sitetitle'])));
        $db->update('setting', array('value' => $_POST['size']), array('name' => 'size'));
        $db->update('setting', array('value' => $_POST['url']), array('name' => 'url'));
        $db->update('setting', array('value' => $_POST['total']), array('name' => 'total'));
        $db->update('setting', array('value' => $_POST['admin']), array('name' => 'admin'));
        $db->update('setting', array('value' => $_POST['subtitle']), array('name' => 'subtitle'));
...

There you see, no CSRF token, which could lead to system setting modification once the admin visits a malicious web page.

下載頁面上面出現這兩串~~

Warning: set_time_limit() has been disabled for security reasons in /home/snowdrive/public_html/downfile.php on line 10

Warning: Cannot modify header information - headers already sent by (output started at /home/snowdrive/public_html/downfile.php:10) in /home/snowdrive/public_html/downfile.php on line 31

下載頁面上面出現這兩串~~

CSRF Vulnerability in /admin/newb.php

/admin/newb.php
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];

Obviously it does not implement a CSRF token, which makes it possible that a new user could be created once the admin visits the following web page

<form action="http://allendiskdemo.com/admin/newb.php" method="POST">
<input type=text name=username value=newuser>
<input type=text name=password value=passw0rd>
<input type=text name=email [email protected]>
</form>
<script>document.form[0].submit()</script>

SSRF Vulnerability in /remotedownload.php

/remotedownload.php

$file = @file_get_contents($_POST['file']);
$header = @get_headers($_POST['file'], 1);
if ($file !== false && stripos($header[0], '200') !== false) {

Obviously, $_POST['file'] could be within intranet ip range, eg. file=http%3A%2F%2F192.168.1.1%2Fvulnerable-router.php, thus exposing a great attack surface.

Captcha Bypass Vulnerability in /reg.php

/reg.php

if (isset($_POST[ 'name']) && isset($_POST[ 'password2']) && isset($_POST[ 'password']) && $config[ 'reg'] == 'true') {
    $username = $_POST[ 'name'];
    $email = $_POST[ 'email'];
    $password = $_POST[ 'password'];
    $password2 = $_POST[ 'password2'];
    $namecheck = $db->ExecuteSQL(sprintf("SELECT count(*) AS `count` FROM `user` WHERE `name` = '%s'", $db->SecureData($username)));
    if ($namecheck[0]['count'] > 0) {
        $err = 2;
    } elseif ($username == '') {
        $err = 0;
    } elseif ($email == '') {
        $err = 0;
    } elseif ($password == '') {
        $err = 0;
    } elseif ($password != $password2) {
        $err = 1;
    } elseif (strtolower($_POST['captcha']) != strtolower($_SESSION['captcha']['code'])) {
        $err = 4;
    } else {
        $db->insert(array('name' => $username, 'pass' => password_hash($password, PASSWORD_DEFAULT), 'email' => $email), 'user');
        $err = 3;
    }
}

As with Captcha Bypass Vulnerability in /admin/loginc.php, the following code does not check wether isset($_SESSION['captcha']['code'])==1,
} elseif (strtolower($_POST['captcha']) != strtolower($_SESSION['captcha']['code'])) {
So, in order to bypass this captcha, we could simply empty $_POST['captcha'], but make sure there is no previous GET request to /reg.php.

Session Fixation Vulnerability in /admin/loginc.php

/admin/loginc.php

include '../config.php';
if (!session_id()) {
    session_start();
}
$res = $db->select('setting', array('name' => 'admin'));
if ($_POST['password'] == $res[0]['value'] && strtolower($_POST['captcha']) == strtolower($_SESSION['captcha']['code'])) {
    $_SESSION['alogin'] = true;
    header('Location: index.php');
} else {
    header('Location: login.php?err=1');
}

Like Session Fixation Vulnerability in /loginc.php, the system does not regenerate a new session_id after the admin successfully logged in, which could lead to admin account takeover with the help of any XSS vulnerability in the same domain.

CSRF Vulnerability in /admin/manuser.php

/admin/manuser.php

if (isset($_GET['delete'])) {
    $file_list = $db->select('file', array('owner' => $_GET['delete']));
    if (is_array($file_list)) {
        foreach ($file_list as $d) {
            @unlink(dirname(dirname(__FILE__)).'/file/'.$d['realname'].'.data');
            $db->delete('file', array('id' => $d['id']));
        }
    }
    $dir_list = $db->select('dir', array('owner' => $_GET['delete']));
    if (is_array($dir_list)) {
        foreach ($db->select('dir', array('owner' => $_GET['delete'])) as $d) {
            $db->delete('dir', array('id' => $d['id']));
        }
    }
    $db->delete('user', array('name' => $_GET['delete']));
    $alert = "<div class='alert alert-success'>刪除成功</div>";
}

Without a CSRF token, any existed user and his data could be deleted once the admin visits the following page:

<img src="http://localhost/admin/manuser.php?delete=victim" />

Captcha Bypass Vulnerability in /admin/loginc.php

/admin/loginc.php

include '../config.php';
if (!session_id()) {
    session_start();
}
$res = $db->select('setting', array('name' => 'admin'));
if ($_POST['password'] == $res[0]['value'] && strtolower($_POST['captcha']) == strtolower($_SESSION['captcha']['code'])) {
    $_SESSION['alogin'] = true;
    header('Location: index.php');
} else {
    header('Location: login.php?err=1');
}

Note that $_SESSION['captcha']['code'] is set in /captcha/simple-php-captcha.php.
To bypass the captcha verification, we simply need to empty the $_POST['captcha'], but be sure there is no previous request to /captcha/simple-php-captcha.php.

How to fix:

- if ($_POST['password'] == $res[0]['value'] && strtolower($_POST['captcha']) == strtolower($_SESSION['captcha']['code'])) {
+ if ($_POST['password'] == $res[0]['value'] && isset($_SESSION['captcha']['code']) && strtolower($_POST['captcha']) == strtolower($_SESSION['captcha']['code'])) {

大檔案下載時解密失敗

遇到比較大的檔案,雖然可以被上傳,但沒有辦法正確被解密,檔案大小小於記憶體限制,然而 PHP 只會回傳一個 0B 的空檔案

Session Fixation Vulnerability in /loginc.php

/loginc.php

if (!session_id()) {
    session_start();
}
...
...
$username = $_POST['name'];
$password = $_POST['password'];
$res = login($username, $password);
switch ($res) {
    case 0:
        echo 1;
    break;

    case 1:
        $_SESSION['login'] = true;
        $_SESSION['username'] = htmlspecialchars($username);
        $_SESSION['password'] = md5_128($password);
        echo 2;
    break;

    default:
        echo 0;
    break;
}

We can see that even after we successfully logged in, the system does not regenerate a new session_id.
Note that this Session Fixation Vulnerability could easily be exploited with the help of any XSS Vulnerability in the same domain, eg. XSS Vulnerability in /readfile.php, as there is no Http-Only flag.

<script>
document.cookie="session_name=session";
document.cookie="session=HACKED";
</script>

Once the victim logged in with the session cookie above, then the attacker could take full control of the victim's account using the same cookie.

Session Bug - 無帳號登入

在同一伺服器中
先登入LTAYER,再開啟AllenDisk
會發生AllenDisk跳過登入前主頁面,直接進入檔案管理頁面
推估是Session名稱重複
還在想解決方案

MYSQL Bug

當我使用MySQL Community Server時,AllenDisk出現Bug
情況為當我上傳檔案且上傳程式顯示成功上傳時,檔案未能出現於網頁中,但文件成功加密並儲存。
以及PHPMYADMIN中未看見資料庫中有任何記錄出現
但我使用XAMPP中的MYSQL時並沒有出現以上錯誤。

系統環境:
OS : Windows Server 2012 R2
Web Server : IIS 7
MySQL DataBase : MySQL Community Server 5.6.27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.