Buffer Overflows

Buffer overflows 缓冲区溢出  软件安全最大的威胁----缓冲区溢出  缓冲区:为大量的连续的同类型数据分配一段存储区域  缓冲区溢出:程序员写的数据超过了缓冲区的边界,将会覆盖邻近的区域 立即下载
No, I’m not talking about the kind of buffer overflows that viruses can take advantage of to inject malicious code onto other systems, I’m talking about the kind that, if you use Filemon or Regmon, you’ve probably seen in their traces. If you’ve never noticed one, fire up one of those two tools and after collecting a log of system-wide activity, find an example by searching for “buffer overflow”. Here’s an example of file system buffer overflow errors:



Do these errors indicate a problem? No, they are a standard way for the system to indicate that there’s more information available than can fit into a requester’s output buffer. In other words, the system is telling the caller that if it was to copy all the data requested, it would overflow the buffer. Thus, the error really means that a buffer overflow was avoided, not that one occurred.

Given that a buffer overflow means that a requester didn’t receive all the data that they asked for you’d expect programmers to avoid them, or when they can’t, to follow with another request specifying a buffer large enough for the data. However, in the Filemon trace neither case applies. Instead, there are two different requests in a row, each resulting in buffer overflow errors. In the first request the Csrss.exe process, which is the Windows environment subsystem process, queries information about a file system volume and in the second request it queries information about a particular file. It doesn’t follow up with successful requests, but continues with other activity.

The answer to why Csrss.exe doesn’t care that its requests result in errors lies in the type of requests it’s making. A program that queries volume information using Windows APIs is underneath using the NtQueryVolumeInformationFile API that’s exported by Ntdll.dll, the Native API export DLL (you can read more about the Native API here). There are several different classes of information that a program can query. The one that Csrss is asking for in the trace is FileFsVolumeInformation. The Windows Installable File System (IFS) Kit documents that for that class a caller should expect output data to be formatted as a FILE_FS_VOLUME_INFORMATION structure, which looks like this:

typedef struct _FILE_FS_VOLUME_INFORMATION {
LARGE_INTEGER VolumeCreationTime;
ULONG VolumeSerialNumber;
ULONG VolumeLabelLength;
BOOLEAN SupportsObjects;
WCHAR VolumeLabel[1];
} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;

Notice that the first four fields in the structure have a fixed length while the last field, VolumeLabel, has a size that depends on the length of the volume’s label string.

When a file system driver gets this type of query it fills in as much information as fits in the caller’s buffer and, if the buffer is too small to hold the entire structure, returns a buffer overflow error and the size of the buffer required to hold all the data. I suspect that Csrss is really only interested in the volume creation time and therefore passing in a buffer only large enough to hold the first part of the structure. The file system driver fills that part in, and because the volume label won’t fit in Csrss’s buffer, returns an error. However, Csrss has gotten the information it wanted and ignores the error.

The second buffer overflow has a similar explaination. Csrss is querying information about a file using the FileAllInformation class of NtQueryInformationFile. The IFS Kit documents the output structure as:

typedef struct _FILE_ALL_INFORMATION {
FILE_BASIC_INFORMATION BasicInformation;
FILE_STANDARD_INFORMATION StandardInformation;
FILE_INTERNAL_INFORMATION InternalInformation;
FILE_EA_INFORMATION EaInformation;
FILE_ACCESS_INFORMATION AccessInformation;
FILE_POSITION_INFORMATION PositionInformation;
FILE_MODE_INFORMATION ModeInformation;
FILE_ALIGNMENT_INFORMATION AlignmentInformation;
FILE_NAME_INFORMATION NameInformation;
} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;

Again, the only variable length field is the last one, which stores the name of the file being queried. If Csrss doesn’t care about the name, only the information preceding it in the structure, it can pass a buffer only large enough to hold those fields and ignore the buffer overflow error.

Incidentally, a stack trace of the second buffer overflow reveals this:



What is the "sxs" module? A look at the sxs DLL in Process Explorer’s DLL View of the Csrss process shows this:



SxS is the “Fusion” DLL, which a little research will show manages the Side-by-Side Assembly storage that allows multiple versions of the same DLLs to exist in harmony on a system. SxS is calling GetFileInformationByHandle, which is a Windows API documented in the Platform SDK. The API takes a file handle as input and returns a buffer formatted as a BY_HANDLE_FILE_INFORMATION structure:

typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD dwVolumeSerialNumber;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD nNumberOfLinks;
DWORD nFileIndexHigh;
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION;

All of the information returned in this structure, except for the volume serial number, is also returned in the FILE_ALL_INFORMATION structure. You can therefore probably guess where the call to NtQueryVolumeInformationFile that occurs immediately prior to the NtQueryInformationFile call originates: GetFileInformationByHandle first queries the volume in order to get its serial number.

Our investigation shows that the buffer overflow errors seen in the Filemon trace are errors expected by the GetFileInformationByHandle API, which is simply avoiding the need to allocate buffers large enough to hold information it’s not interested in. The bottom line is that buffer overflow errors in a Filemon trace are not an indication that there's a security problem and are usually not due to bad programming.

Next time I’ll explore buffer overflows in Regmon traces. 
星载SAR系统参数设计过程自动化方法研究  本文提出了一种 SAR系统参数自动化设计的 方法。首先,针对部分参数仍需手工选取的现状 建立了最优化求解模型,并给出了 PRF 和波位位 置的优化选取结果,使参数设计流程更加高效便 捷。然后,针对 SAR 系统参数设计过程中部分技 术指标的评测结果不满足用户需求时无法自动调 节的现状,采用 PID 控制器对方位向天线尺寸、信 号带宽、PRF 等参数进行自动调节,使得方位分辨 率、距离分辨率、方位模糊比等技术指标向用户需 求值逐步靠近。通过仿真实验验证了该方法的可 行性,实现了SAR系统参数设计过程的自动化 阅读详情

相关推荐

BEVFusion(mit)最强环境安装,部署复现

BEVFusion作为一项经典的工作,值得深入探索。然而由于配置环境比较麻烦,耽误了一些时间。经过几次成功配置之后,有了一些总结,在这里记录下来,供大家参考避坑,也方便自己下次查阅。

qq_45783225的博客 1万+

Buffer Overflow缓冲区溢出和保护措施

缓冲区溢出是指当数据写入某个缓冲区(buffer)时,,从而导致覆盖了相邻内存区域的情况。这种现象可能导致程序崩溃、数据损坏,甚至引发安全漏洞,允许攻击者利用这一漏洞执行恶意代码。比如这个代码中,在内存中,a中的元素和d其实是挨着的,如果给a赋值了超过了它当前容量的数据,那么就会覆盖d的内容,导致d的值混乱。

TranSad的博客 5711

UVM入门与进阶学习笔记17——寄存器模型(3)

目录寄存器模型的常规方法mirror、desired和actual valueprediction的分类自动预测显式预测uvm_reg的访问方法mem与reg的联系和差别内建(built-in)sequences寄存器模型内建序列存储模型内建序列寄存器健康检查寄存器应用场景寄存器检查功能覆盖率概述覆盖率自动收集模式覆盖率外部事件触发收集 寄存器模型的常规方法 mirror、desired和actual value 在应用寄存器模型时,除了利用它的寄存器信息,也会利用它跟踪寄存器的值。 寄存器模型中的每

weixin_41979380的博客 7536

Process monitor词汇汉化

Process Monitor一款系统进程监视软件,总体来说,Process Monitor相当于Filemon+Regmon,其中的Filemon专门用来监视系统 中的任何文件操作过程,而Regmon用来监视注册表的读写操作过程。 有了Process Monitor,使用者就可以对系统中的任何文件和 注册表操作同时进行监视和记录,通过注册表和文件读写的变化, 对于帮助诊断系统故障或是

qlexcel的专栏 2211

电驱系统功率级“多合一”解决方案

如何提升电驱动系统的产品性能、减小能耗和进一步轻量化,以加强整车市场竞争力,是摆在国内外新能源车企面前的共同课题。为此,具有多年动力总成电子系统开发经验的美国著名半导体及电子解决方案专家——德州仪器(Texas Instrument)提出了多种功率级别“多合一”整合方案和设计思路,助力新能源车企提升技术优势。

yessunday的专栏 1372

从零构建Fama-French多因子模型:量化投资系统开发实战

本文详细介绍了如何从零构建Fama-French多因子模型,并将其应用于量化投资系统的开发。首先,文章概述了Fama-French多因子模型的背景、核心原理和架构,解释了其如何通过引入市场风险、规模、价值、盈利和投资等因子来解释股票收益率的变化。接着,文章详细阐述了构建该模型的具体步骤,包括因子的计算、因子暴露的确定以及模型的估计。通过数学模型和公式,文章对模型进行了理论推导,并举例说明了其应用。此外,文章还提供了项目实战的代码案例,从开发环境搭建到源代码实现,逐步指导读者完成量化投资系统的开发。最后,文章

2501_92132293的博客 1226

缓存溢出Buffer Overflow

缓存溢出(Buffer overflow),是指在存在缓存溢出安全漏洞的计算机中,攻击者可以用超出常规长度的字符数来填满一个域,通常是内存区地址。在某些情况下,这些过量的字符能够作为“可执行”代码来运行。从而使得攻击者可以不受安全措施的约束来控制被攻击的计算机。 缓存溢出(或译为缓冲溢出)为黑客最为常用的攻击手段之一,蠕虫病毒对操作系统高危漏洞的溢出高速与大规模传播均是利用此技术。

远有青山 1万+

等保测评-达梦数据库

一般适用于等保测评

m0_54146694的博客 1297

Buffer overflows 缓冲区溢出

}  Buffer overflows 缓冲区溢出 }  软件安全最大的威胁----缓冲区溢出 }  缓冲区溢出导致的问题已经数十年了,最著名的例子是1988年的网络蠕虫 }  1999年CERT/CC公示显示,所有严重的安全漏洞有50%是缓冲区溢出导致的,数据显示缓冲区溢出所占比重逐年增加而不是逐年减少。 }  缓冲区溢出问题的现状 }  CERT/CC公告显示在过去的11年间安全漏洞

大傻2代的博客 2970

基于YOLOv8的水果新鲜程度检测系统设计与实现

数据采集与预处理模块:负责收集水果图像数据并进行标注和增强深度学习模型:基于YOLOv8的目标检测模型新鲜度评估模块:根据检测结果评估水果新鲜程度用户界面:提供友好的交互界面系统集成:将各模块整合为完整系统水果新鲜程度检测需要包含多种水果在不同新鲜度状态下的图像数据集。:包含5种常见水果(苹果、香蕉、橙子、葡萄、草莓)在不同新鲜度下的图像包含约8,000张图像,分为新鲜和腐烂两类AgriVision:大型农业图像数据集,包含水果检测和分类任务Fruit-360:包含120种水果的高质量图像。

YOLO 445

博途PLC模糊PID控制(附SCL完整源代码)

操作人员根据对象的当前状态和以往的控制经验,用手动控制的方法给出适当的控制量,对被控对象进行控制。用电脑模拟操作人员手动控制的经验,对被控对象进行控制。用模糊数学的知识模仿人脑的思维方式,对模糊现象进行识别和判决,给出精确的控制量,对被控对象进行控制。与经典控制理论和现代控制理论相比,模糊控制的特点是不需要建立对象的精确模型。根据操作人员手动控制的经验,总结的完整控制规则,在根据系统当前的运行状态,经过模糊推理,模糊判决等运算,求出控制量,实现对被控对象的控制。......

RXXW_Dor的博客 8967

Buffer overflows详解

缓冲区溢出即指在程序执行过程中,向缓冲区写入数据时超出了其预留的存储空间,导致数据溢出并覆盖其他内存区域的现象。这种情况可能导致程序崩溃、执行意外操作,甚至被攻击者利用来执行恶意代码。缓冲区溢出是计算机系统中常见且危险的安全漏洞,攻击者可以通过利用这一漏洞来执行恶意代码,威胁系统安全。本文从概述、攻击方式和防范措施三个方面对缓冲区溢出进行了详细介绍。为了保障系统的安全性,开发人员应该始终关注并采取相应的防范手段,避免被攻击者利用缓冲区溢出漏洞造成损失。

m0_72410588的博客 974

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Win32 Buffer Overflows

--------[ dark spyrit AKA Barnaby Jack   ]----[  Abstract"If you assume that theres no hope, you guarantee there will be no hope.If you assume that there is an instinct for freedom, there areopportun

3001

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Buffer Overflows in Regmon Traces

Last time I talked about buffer overflow errors that you might see in Filemon traces. Now I’ll turn my attention to the same errors, but in Regmon traces. Recall that a buffer overflow error in this c

958

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Lab 1: Buffer Overflows

课程主页: http://staff.ustc.edu.cn/~bjhua/courses/security/2014/labs/lab1/index.html Lab Overview 这里介绍了课程实验最终所要达到的目标, 以及所用的实验环境.相对前几届的实验,多了一个名为Touchstone的web server. Touchstone为试金石之意, 寓意其为判断学生所学的效果

2138

Buffer Overflows, ASLR, and Stack Canaries

Introduction Buffer overflow exploits are one of the most common and classic security vulnerabilities in computer programs. A buffer overflow exploit sends a buffer more data than is expected with a ...

omnispace的博客 838

Buffer overflows:课程

http://css.csail.mit.edu/6.858/2020/labs/lab1.html

mzhan017的博客 434

Buffer Overflows Lab

stack 大概长这样 Level 0: Candle 只要覆盖掉return 就行了 比如: c0 10 40 00 00 00 00 00 c0 10 40 00 00 00 00 00 c0 10 40 00 00 00 00 00 c0 10 40 00 00 00 00 00 c0 10 40 00 00 00 00 00 c0 10 40 00 00 00 00 ...

weixin_30553777的博客 208

WebGoat第五关:Buffer Overflows

缓冲区溢出攻击,多么cooooooooooooool的名字。 然后。。。然后就没有然后了。。。。。 我只发图,不说话。。。。

锐之锋芒 2508

How to write Buffer Overflows

Mudge博士于1995年发表的论文:《How to write Buffer Overflows》 http://insecure.org/stf/mudge_buffer_overflow_tutorial.html This is really rough, and some of it is not needed. I wrote this as a reminder no

天元喜羊羊的博客 1165

Handling oprofile sample buffer overflows

<br /> <br />https://www.ibm.com/developerworks/wikis/display/LinuxP/Handling+oprofile+sample+buffer+overflows

旁门左道 792

Buffer Overflows(oscp)

oscp

qq_48514193的博客 438

防止stack buffer overflows攻击的方法 : ShadowCallStack

1、介绍 ShadowCallStack 是一个检测通道,目前只为 aarch64 实现,它可以保护程序免受返回地址覆盖(例如堆栈缓冲区溢出 : stack buffer overflows)。它的工作原理是将函数的返回地址保存到函数序言中单独分配的“shadow call stack”,子函数并从函数结语中的shadow call stack加载返回地址。 2、用法 要启用 ShadowCallStack,只需将-fsanitize=shadow-call-stack 标志传递给编译和链接命令行。在 aa

baron-周贺贺-代码改变世界ctw 1422

OSCP Learning Notes - Buffer Overflows(2)

Finding the Offset 1. Use the Metasploite pattern_create.rb tool to create 5900 characters. /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 5900 2.Write the python test sc...

weixin_30814223的博客 682

Blind Buffer Overflows In ISAPI Extensions

Blind Buffer Overflows In ISAPI Extensions BY Isaac Dawson @2005-01-25 Introduction The topic of blind buffer overflow exploitation or exploitation without access to the binary or system running the a...

爱.NET 225
上一篇: Unkillable Processes
下一篇: Buffer Overflows in Regmon Traces
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值