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漏洞的更多相关文章

  1. 汉澳sinox不受openssl心血漏洞影响并分析修复其漏洞代码

    OpenSSL 心血(HeartBleed)漏洞 是openssl 在 2014-04-07 发布的重大安全漏洞(CVE-2014-0160)这个漏洞使攻击者可以从server内存中读取64 KB的数 ...

  2. 非常多人不愿意承认汉澳sinox已经超过windows

    汉澳sinox採用的zfs和jail打造高可靠性存储server和矩阵计算机,这不是windows和linux能相提并论的. 只是非常多人立即出来出来反驳说,windows驱动程序多(就是支持硬件多) ...

  3. 汉澳sinox通过ndis执行windows驱动程序

    汉澳sinox不仅能通过wine执行windows应用程序.还能通过ndis执行windows驱动程序 汉澳sinox使用 Windows NDIS 驱动程序 详细实现方法是用ndisgen把wind ...

  4. bash shell漏洞及测试

    1.bash shell是大多数linux发行版本的默认shell命令解释器,但是最近爆出bash shell存在漏洞. 2.如果Bash是默认的系统shell,网络攻击者可以通过发送Web请求.se ...

  5. 汉澳Sinox2014X64server高级桌面服务器版操作系统公布

    汉澳Sinox2014X64server高级桌面服务器版操作系统公布   当你在现代城市夜空中看到一道闪电.屏幕中央闪过几个图形,转眼间变成美轮美奂的紫色空中天国,说明你来到了汉澳sinox2014世 ...

  6. 开发汉澳即时通信网,2006年上线,QQ死期到了

    为汉澳sinox用户打造即时通信网让大家用上即时通信软件 近期腾讯关闭了linuxQQ登录,汉澳 sinox也登陆不上.非windows用户再也不能用上即时通信软件了! 这是多么可悲的事,可是我们必须 ...

  7. 汉澳sinox2014没有黑屏,一个能够依靠的安全避风港

    首先汉澳sinox2014没有验证server,根本就没办法区分正版和盗版 其次汉澳sinox2014安装也没有系列号cdkey等东西,直接安装无干扰 最后汉澳sinox2014不会有黑屏这样的东西. ...

  8. 《Linux命令行与shell脚本编程大全》 第三章 学习笔记

    第三章:基本的bash shell命令 bash程序使用命令行参数来修改所启动shell的类型 参数 描述 -c string 从string中读取命令并处理他们 -r 启动限制性shell,限制用户 ...

  9. Linux Shell——bash shell 脚本简介

    bash shell 脚本简介 shell 运行环境 如果你运行的是 Unix 或 Linux 系统,例如 Ubuntu,Red Hat,SUSE Linux,还有macOS,都是内置了 bash s ...

随机推荐

  1. 測試 電池溫度的 batch file

    無限迴圈, 執行讀取 電池溫度, @echo off adb root :loop echo %date% %time% adb shell "cat /sys/class/power_su ...

  2. svn报“Previous operation has not finished; run 'cleanup' if it was interrupted”的错误

    -.叙述 今天需要更新接口文檔,所以就update了一下,結果報了如下錯誤:      Error : Previous operation has not finished; run 'cleanu ...

  3. Java---杨辉三角简易解法(通俗易懂,逻辑严密)

  4. 【lombok】lombok---帮你简化生成必要但臃肿的java代码工具 【映射注解和lombok注解同时使用 以及 映射注解放在属性和get方法上的区别】

    官方地址:https://projectlombok.org/ GitHub:https://github.com/rzwitserloot/lombok 指导说明文档:http://jnb.ociw ...

  5. windows上,python安装非官方包,提示error: Unable to find vcvarsall.bat

    在windows机器上安装python非官方包,如果环境只是用于开发,不作任何测试的话,最好的解决办法是: 在Linux上pip安装好之后,把python根目录lib/python3.6/site-p ...

  6. ubuntu 安装花生壳

    由于无线路由的IP总是变换,所以想在机器上装一个花生壳,然后通过域名来访问这个机器,这样就算IP变了也没有关系.我的机器的系统是ubuntu 12.04 desktop  cd 到一个目录,我用的是D ...

  7. Ubuntu下sudo apt-get install vim 失败的解决办法

    Ubuntu下 执行命令:sudo apt-get install vim 失败 解决办法: 更新一下,命令:sudo apt-get update 再安装即可成功:sudo apt-get inst ...

  8. Oracle数据泵远程导入文件到本地数据库

    --以dba身份登录 C:\Users\Administrator>sqlplus / as sysdba --创建用户 SQL> create user bfzg0828 identif ...

  9. 【重点突破】——第三方绘图工具FusionCharts.js的使用详解

    一.引言 项目组中,经常会因为绘制图表的繁杂度,衡量会不会使用第三方绘图工具,如果自己做很困难,成本使用高于第三方绘图工具库,就会使用.很多人使用的是Chart.js,因为它是免费使用的,不过,缺点就 ...

  10. linux中du的用法

    du:Disk Usage的缩写,命令功能为显示目录(或文件)所占磁盘空间的大小. 语 法:du [-abcDhHklmsSx0] [-L][-X File][--block-size=SIZE][- ...