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

secured environment for output generation #3

Open
skhuang opened this issue Nov 29, 2013 · 6 comments
Open

secured environment for output generation #3

skhuang opened this issue Nov 29, 2013 · 6 comments
Assignees

Comments

@skhuang
Copy link

skhuang commented Nov 29, 2013

你們在產生 output 或進行 fault localization 時,有 security 的問題要注意。因為程式可以寫
system("rm -rf *");
這樣你們的資料就會被殺光。你們可能要先過濾程式是否有 system, unlink 等 function call.
後續,我再教你們如何處理這類型的問題。

@ghost ghost assigned kid9917002 Nov 29, 2013
@skhuang
Copy link
Author

skhuang commented Nov 29, 2013

你們在執行外部命名時,原本是以 www-data 執行 cmd arg ....
現在改為
/usr/bin/sudo /bin/su penobody -c cmd arg ...

這樣就以 penobody 的權限執行,就無法動到 www-data 的檔案。

@skhuang
Copy link
Author

skhuang commented Nov 29, 2013

另外有關 security ,另外解法是 linux control group, 用 cgexec. 我們後續可慢慢學。

@lancechentw
Copy link
Member

you may also consider using

/usr/bin/sudo -u penobody cmd args

@skhuang
Copy link
Author

skhuang commented Dec 1, 2013

it is restricted in /etc/sudoers with NOPASSWD for /bin/su penobody -c. Is it possible to limit sudo -u penobody without password ? the command launched by www-data is from web applications.

@lancechentw
Copy link
Member

Sure, a simple example

www-data    ALL = (penobody) NOPASSWD: /usr/bin/cmdA, /usr/bin/cmdB, /usr/bin/cmdC

User www-data can run cmdA, cmdB and cmdC as user penobody without authentication on any hosts.

@skhuang
Copy link
Author

skhuang commented Dec 2, 2013

It is a better solution. We need the whitelist of cmdA,B,C. Another concern is that the command executed may create a backdoor to other sites. (I just restrict outgoing connection)

@skhuang skhuang closed this as completed Dec 4, 2013
@skhuang skhuang reopened this Dec 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants