高速修复汉澳sinox命令解释程序bash shell漏洞
bash是linux默认命令行管理程序shell。汉澳 sinox也安装有,尽管sinox并没有默认使用bash。可是用户一旦使用就会可能被通过漏洞入侵,所以必须高速修复。尽管sinox使用freebsd 的ports,可是freebsd已经升级到最新的软件管理pkg,ports正在被淘汰,要通过portsnap直接更新到最新的ports然后用pkg安装。只是最新的ports仅仅是在freebsd10以上使用。对于低版本号pkg可能不支持。无论怎么说,假设你要用pkg,仅仅能用freebsd10,否则问题会非常多,pkg会直接升级到软件的最新版本号。pkg产生是为了实现类似yum直接更新二进制程序。
要想编译最新的ports,先编译安装最新的pkg。
最新的ports在sinox执行有的程序会有问题的。
既然如此。我们仅仅能改动 sinox当前版本号bash,把漏洞堵上去。先看bash漏洞。
执行env x='() { :;}; echo vulnerable’ bash -c “echo this is a test”
产生结果
vulnerable
echo this is a test
问题是,环境变量x通过() { :;}; echo vulnerable获得,但当中echo是系统命令。会运行。
假设把 echo vulnerable改成ls,pwd会怎么样,假设是sudo就会获得超级管理员的权限。
网页用户能够通过cgi程序等方式使用bash执行指令控制系统。
我查阅了网上资料,堵漏洞原理就是修改程序中对引入函数的处理,并參考了最新bash ports修改方式,制定了当前版本号bash堵漏洞办法。
先用make extract,make patch把代码解压出来,然后备份shell.c和variables.c为后面加.orig,然后改动shell.c和variables.c,改好后进入源代码文件夹生成补丁。
diff -uN shell.c.orig shell.c > shell.c.patch
diff -uN variables.c.orig variables.c >variables.c.patch
把生成的patch文件放到ports源代码files文件夹.然后在 Makefile添加这两行
EXTRA_PATCHES+= ${PATCHDIR}/shell.c.patch
EXTRA_PATCHES+= ${PATCHDIR}/variables.c.patch
如今进入文件夹,make clean;make。检查一下代码是否已经改正好。
假设好了就make install.
为了强制安装,我在/etc/make.conf添加
FORCE_PKG_REGISTER=yes
安装好了以后。执行bash。输入上面命令行,不再出现vulnerable,修复成功。
为了用gcc4.6编译,我在make.conf设置
DISABLE_VULNERABILITIES=YES
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc46)
CC=gcc46
CXX=g++46
CPP=cpp46
.endif
以下粘贴patch文件
shell.c.patch
— shell.c.orig 2011-01-03 05:04:51.000000000 +0800
+++ shell.c 2014-10-11 17:37:30.000000000 +0800
@@ -225,7 +225,7 @@
#else
int posixly_correct = 0; /* Non-zero means posix.2 superset. */
#endif
–
+int import_functions = 0;//IMPORT_FUNCTIONS_DEF; //patch
/* Some long-winded argument names. These are obviously new. */
#define Int 1
#define Charp 2
@@ -244,6 +244,7 @@
{ “help”, Int, &want_initial_help, (char **)0x0 },
{ “init-file”, Charp, (int *)0x0, &bashrc_file },
{ “login”, Int, &make_login_shell, (char **)0x0 },
+ { “import-functions”, Int, &import_functions, (char **)0x0 }, //patch
{ “noediting”, Int, &no_line_editing, (char **)0x0 },
{ “noprofile”, Int, &no_profile, (char **)0x0 },
{ “norc”, Int, &no_rc, (char **)0x0 },
variables.c.patch
— variables.c.orig 2014-10-11 19:22:10.000000000 +0800
+++ variables.c 2014-10-11 19:21:34.000000000 +0800
@@ -100,6 +100,7 @@
extern int assigning_in_environment;
extern int executing_builtin;
extern int funcnest_max;
+extern int import_functions;//patch
#if defined (READLINE)
extern int no_line_editing;
@@ -312,7 +313,8 @@
char *name, *string, *temp_string;
int c, char_index, string_index, string_length;
SHELL_VAR *temp_var;
–
+ int skipped_import;//patch
+
create_variable_tables ();
for (string_index = 0; string = env[string_index++]; )
@@ -335,11 +337,18 @@
char_index == strlen (name) */
temp_var = (SHELL_VAR *)NULL;
–
+ skipped_import = 0;//patch
+reval: //patch
/* If exported function, define it now. Don’t import functions from
the environment in privileged mode. */
– if (privmode == 0 && read_but_dont_execute == 0 && STREQN (“() {“, string, 4))
+ if (skipped_import == 0 && privmode == 0 && read_but_dont_execute == 0 && STREQN (“() {“, string, 4)) //patch
{
+ if (!import_functions && !interactive_shell) { //patch————
+ skipped_import = 1;
+ //report_error (_(“Skipping importing function definition for `%s': –import-functions required.”), tname);
+ goto reval;
+ } //———–patch
+
string_length = strlen (string);
temp_string = (char *)xmalloc (3 + string_length + char_index);
我为sinox2014就是64位制作了bash修复安装包。安装命令例如以下|
pkg_add -f ftp://sinox.3322.org/bash-4.2.20.tbz
sinox2013没有制作修复安装包。大家能够自己按上面说明自己编译修复。
高速修复汉澳sinox命令解释程序bash shell漏洞的更多相关文章
- 汉澳sinox不受openssl心血漏洞影响并分析修复其漏洞代码
OpenSSL 心血(HeartBleed)漏洞 是openssl 在 2014-04-07 发布的重大安全漏洞(CVE-2014-0160)这个漏洞使攻击者可以从server内存中读取64 KB的数 ...
- 非常多人不愿意承认汉澳sinox已经超过windows
汉澳sinox採用的zfs和jail打造高可靠性存储server和矩阵计算机,这不是windows和linux能相提并论的. 只是非常多人立即出来出来反驳说,windows驱动程序多(就是支持硬件多) ...
- 汉澳sinox通过ndis执行windows驱动程序
汉澳sinox不仅能通过wine执行windows应用程序.还能通过ndis执行windows驱动程序 汉澳sinox使用 Windows NDIS 驱动程序 详细实现方法是用ndisgen把wind ...
- bash shell漏洞及测试
1.bash shell是大多数linux发行版本的默认shell命令解释器,但是最近爆出bash shell存在漏洞. 2.如果Bash是默认的系统shell,网络攻击者可以通过发送Web请求.se ...
- 汉澳Sinox2014X64server高级桌面服务器版操作系统公布
汉澳Sinox2014X64server高级桌面服务器版操作系统公布 当你在现代城市夜空中看到一道闪电.屏幕中央闪过几个图形,转眼间变成美轮美奂的紫色空中天国,说明你来到了汉澳sinox2014世 ...
- 开发汉澳即时通信网,2006年上线,QQ死期到了
为汉澳sinox用户打造即时通信网让大家用上即时通信软件 近期腾讯关闭了linuxQQ登录,汉澳 sinox也登陆不上.非windows用户再也不能用上即时通信软件了! 这是多么可悲的事,可是我们必须 ...
- 汉澳sinox2014没有黑屏,一个能够依靠的安全避风港
首先汉澳sinox2014没有验证server,根本就没办法区分正版和盗版 其次汉澳sinox2014安装也没有系列号cdkey等东西,直接安装无干扰 最后汉澳sinox2014不会有黑屏这样的东西. ...
- 《Linux命令行与shell脚本编程大全》 第三章 学习笔记
第三章:基本的bash shell命令 bash程序使用命令行参数来修改所启动shell的类型 参数 描述 -c string 从string中读取命令并处理他们 -r 启动限制性shell,限制用户 ...
- Linux Shell——bash shell 脚本简介
bash shell 脚本简介 shell 运行环境 如果你运行的是 Unix 或 Linux 系统,例如 Ubuntu,Red Hat,SUSE Linux,还有macOS,都是内置了 bash s ...
随机推荐
- 快速排序Quick sort(转)
原理,通过一趟扫描将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小,然后再按此方法对这两部分数据分别进行快速排序,整个排序过程可以递归进行,以此达到整个数据变成有序 ...
- Guice 4.1教程
Guice是Google开发的一个开源轻量级的依赖注入框架,运行速度快,使用简单. 项目地址:https://github.com/google/guice/ 最新的版本是4.1,本文基于此版本. 0 ...
- centos7.2安装tomcat8
环境: 阿里云centos7.2 tomcat8.0.32 jdk8.131 1 上传tomcat安装包到服务器的/home(个人习惯) 2 解压安装包 [root@iZt4n6h3u4k407nni ...
- Linux笔记:crond
crontab中列出需要执行的命令及执行时间.由于指定的日期Day与星期Week不是相互包含的关系,而是有相交也有不相交的时间.当日期数与星期数均指定为确定值的时候,指令的执行时间到底是什么样的,之前 ...
- GCJ——Minimum Scalar Product(2008 Round1 AA)
题意: 给定两组各n个数,可任意调整同一组数之中数字的顺序,求 sum xi*yi i=1..n的最小值. Small: n<=8 abs xy,yi<=1000 Large: n< ...
- 什么是yarn?
[学习笔记] 什么是yarn?马克-to-win @ 马克java社区:YARN (Yet Another Resource Negotiator,另一种资源协调者)是Hadoop的一个资源管理系统, ...
- servlet与线程与jdbc connection的关系
servlet与线程与jdbc connection的关系 都是一一绑定的关系, servlet接受那么多此请求. 一个请求,对应一个线程,对应一个DB POOL的connection. 因为conn ...
- hdu1420(C++)
数论中模的运算: a*b%n=(a%n)*(b%n)%c; (a+b)%n=(a%n+b%n)%n; 幂的模:A^n%c=r 于是A^(n+1)%c=A*r%c; #include<ios ...
- EasyMvc入门教程-基本控件说明(12)栏目导航
栏目导航一般用来显示当前页面所在的模块层级位置关系,如下图所示: 当然也有前端网站作为小栏目导航,凡是没有绝对,只要不违和就好:),下面上代码: @{ var data = new List<N ...
- SilverLight-DataBinding-DataTemplates: 三、数据绑定 DataTemplates模板的使用(求助,没有到达实例效果,求高人指点迷津)
ylbtech-SilverLight-DataBinding-DataTemplates: 三.数据绑定 DataTemplates模板的使用 1.A, Data Templates Intro(数 ...