Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Audit #2

Open
RicterZ opened this issue Jul 5, 2015 · 10 comments
Open

Code Audit #2

RicterZ opened this issue Jul 5, 2015 · 10 comments

Comments

@RicterZ
Copy link
Collaborator

RicterZ commented Jul 5, 2015

这个 issue 放着所有的安全性问题

@RicterZ
Copy link
Collaborator Author

RicterZ commented Jul 5, 2015

  1. 任意密码重置

./models/users.js

Users.prototype.getByResetKey = function* (key) {
    var timeNow = new Date().getTime();
    var u = yield this.collection.findOne({ resetKey: key });
    if (u && (timeNow - u.resetTime < 7200000)) {
        this.set(u);
        return u;
    } else {
        return null;
    }
};

./controller/api/user.js

api.post('/user/reset-password', function *(next) {
    if (this.request.body) {
        var resetKey = this.request.body.resetKey;
        var password = this.request.body.password;
        if (resetKey && password) {
            var user = new Users();
            var u = yield user.getByResetKey(resetKey);
            if (u) {
                yield user.setPassword(password);
                this.body = { success: true };
                return;
            }
        }
    }
    this.body = { success: false };
});

this.request.body.resetKey 直接获取,导致可以在不需要 resetKey 的情况下重置用户密码。
image

@tengattack
Copy link
Member

The first one has already fixed in 3787ddb & updated online, pls check

@RicterZ
Copy link
Collaborator Author

RicterZ commented Jul 5, 2015

  1. XSS in torrent
    解析种子的时候,未过滤种子中的文件名。构造恶意的种子:
    image
    上传后:
    image

@tengattack
Copy link
Member

@RicterZ the second one fixed, pls check

@RicterZ
Copy link
Collaborator Author

RicterZ commented Jul 5, 2015

/w\ 于是就发现了这么多问题..暂时..

@RicterZ
Copy link
Collaborator Author

RicterZ commented Jul 5, 2015

XSS Filter 并不能绕过去的样子

@phoenixlzx
Copy link
Collaborator

修改任意档的问题确认了么?

@RicterZ
Copy link
Collaborator Author

RicterZ commented Jul 5, 2015

那个好像没有问题

@phoenixlzx
Copy link
Collaborator

@tengattack 修复好了就更新到线上吧先。

然后准备下 trello 上的问题,考完试开始搞... @RicterZ 来一下 Trello 的 ID,加你进去...

@tengattack
Copy link
Member

修复完的时候就更新好了

你们能不能用英文

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants