当前位置: 首页 > news >正文

免费做电脑网站郑州竞价托管

免费做电脑网站,郑州竞价托管,在线教育做网站好还是app好,白种女人做爰网站简单介绍 格式化字符串漏洞和栈溢出有相似之处,但又有所不同,都是利用了程序员的疏忽大意来改变程序运行的正常流程。 1、格式化字符串的介绍 printf()、fprint()等print()系列的函数可以按照一定的格式将数据进行输出。 实例…

简单介绍

格式化字符串漏洞和栈溢出有相似之处,但又有所不同,都是利用了程序员的疏忽大意来改变程序运行的正常流程。

1、格式化字符串的介绍

printf()、fprint()等print()系列的函数可以按照一定的格式将数据进行输出。

实例举例:

printf("I am a %s","student");

执行这条语句后将会返回字符串:I am a student。

这个语句中的printf函数的参数%s就是格式化字符串,它告诉程序将数据以什么格式输出。

2、printf函数一般形式的介绍

printf()函数的一般形式为:printf(“format”,输出表列)

format就表示格式化符号

其中format的结构为:%(标志)(输出最小宽度)(精度)(长度)类型

其中常见的类型有以下几种:

①%d整型输出,%ld长整型输出

②%o以八进制输出

③%x以十六进制形式输出

④%u以十六进制数输出无符号型数据

⑤%c用来输出一个字符

⑥%s用来输出一个字符串

⑦%f用来输出一个实数,以小数形式输出

当我们控制了format参数之后,结合printf()函数的特性就可以进行相应的攻击了。

3、C语言中的格式化函数

C语言中的格式化函数(printf族函数,包括:printf、fprintf、sprintf、snprintf等)允许可变参数,它根据传入的格式化字符串获知可变参数的个数和类型,并依据格式化符号进行参数的输出。

格式化字符串漏洞的利用原理:

如果调用这些函数时,给出了格式化符号串,但没有提供实际对应参数时,这些函数会将格式化字符串后面的多个栈中的内容弹出作为参数,并根据格式化符号将其输出。

4、字符串溢出漏洞利用,常用的格式化符号

在利用格式化字符串溢出的时候,常见的格式化符号有%x,%s,%n:

①当格式化符号为%x时,以16进制的形式输出堆栈的内容;

②当格式化符号为%s时,则输出对应的地址所指向的字符串。

漏洞代码举例:

void function(char *buf){int a=1;printf(buf);}

当向这个函数中传入的字符串为:“%x%x%x”,则输出的结果是将栈中内容按十六进制输出,从而达到窃取栈内容目的。

③当格式化符号为%n时, 他的作用是将格式化函数输出字符串的长度,写入函数参数指定的位置。

解释%n的利用实例:

当一个输出函数的格式化字符为%n。需要注意的是:%n不向printf传递格式化信息,而是令printf把自己到该点已打出的字符总数放到相应变元(未知量)指向的整型变量中。

如:printf(“yuanyexincun%n”,&num)

这条语句将会向整型变量num写入整数5。

5、sprintf()函数的介绍

sprintf()函数的作用是把格式化的数据写入某个字符串缓冲区,函数原型为:

int sprintf(char *buffer,const char *format,[argument]...)

接下来写一个关于sprintf函数的格式化溢出漏洞代码:

int function(int argc,chat *argv[]) //argc表示字符串的个数;argv表示一个字符串{char buffer[100];sprintf(buffer,argv[1]); //argv[1]是一个指向字符串的指针}

这个函数咋一看感觉没什么问题。接一下仔细分析:该函数定义了一个长度为100的数组buffer,用来存放函数接受的字符串argv(此时可能存在缓冲区溢出)。然后调用sprintf函数将格式化数据写入buffer数组中。自此函数分析完毕。

这段代码如果正常输入数据,其实不会影响程序的正常执行,但是当攻击者向这个函数function函数传入的字符串为“aaaabbbb%n”,则最后会将字符串的

长度8,写入到地址为0x61616161(aaaa)的内存单元。(a的ascall码为97,对应的十六进制数为61)

注意事项:当sprintf函数后面没有对应参数时,会从对堆栈中取出一个参数,将其作为整数指针使用。因为aaaabbbb传入栈中是小端存储,所以后入栈的参数是aaaa。


文章转载自:
http://yate.rywn.cn
http://dew.rywn.cn
http://hoop.rywn.cn
http://tufthunter.rywn.cn
http://exhalable.rywn.cn
http://deliver.rywn.cn
http://owing.rywn.cn
http://putlock.rywn.cn
http://subphylum.rywn.cn
http://ismec.rywn.cn
http://papist.rywn.cn
http://bareboat.rywn.cn
http://associational.rywn.cn
http://umber.rywn.cn
http://nih.rywn.cn
http://batfish.rywn.cn
http://pushbutton.rywn.cn
http://xylography.rywn.cn
http://wurst.rywn.cn
http://cimmerian.rywn.cn
http://carbohydrate.rywn.cn
http://teetotalism.rywn.cn
http://amphicrania.rywn.cn
http://dioptrics.rywn.cn
http://underfinanced.rywn.cn
http://samnite.rywn.cn
http://psat.rywn.cn
http://dalesman.rywn.cn
http://sinister.rywn.cn
http://gaberones.rywn.cn
http://stalino.rywn.cn
http://middlebreaker.rywn.cn
http://nonentanglement.rywn.cn
http://simplicidentate.rywn.cn
http://insula.rywn.cn
http://kootenay.rywn.cn
http://lithic.rywn.cn
http://colchicum.rywn.cn
http://opaque.rywn.cn
http://galvanoscope.rywn.cn
http://peritus.rywn.cn
http://chiz.rywn.cn
http://taxation.rywn.cn
http://baalim.rywn.cn
http://polyzoarium.rywn.cn
http://ruralise.rywn.cn
http://outstrip.rywn.cn
http://hebridean.rywn.cn
http://orrisroot.rywn.cn
http://eclosion.rywn.cn
http://discursive.rywn.cn
http://lacw.rywn.cn
http://amelioration.rywn.cn
http://salle.rywn.cn
http://immemorial.rywn.cn
http://tartrate.rywn.cn
http://laggardly.rywn.cn
http://sunbrowned.rywn.cn
http://plutarchy.rywn.cn
http://schoolgirl.rywn.cn
http://greenleek.rywn.cn
http://apparitor.rywn.cn
http://glaucoma.rywn.cn
http://dinero.rywn.cn
http://spew.rywn.cn
http://spuddy.rywn.cn
http://underling.rywn.cn
http://revivatory.rywn.cn
http://kasbah.rywn.cn
http://antivenin.rywn.cn
http://alarum.rywn.cn
http://pintail.rywn.cn
http://ora.rywn.cn
http://parishioner.rywn.cn
http://seedage.rywn.cn
http://orpiment.rywn.cn
http://inappreciative.rywn.cn
http://creedal.rywn.cn
http://irresistibility.rywn.cn
http://hypophyge.rywn.cn
http://peripeteia.rywn.cn
http://pass.rywn.cn
http://turd.rywn.cn
http://platinate.rywn.cn
http://noncontinuous.rywn.cn
http://guncotton.rywn.cn
http://impatiently.rywn.cn
http://screenwasher.rywn.cn
http://analogist.rywn.cn
http://foliature.rywn.cn
http://punctated.rywn.cn
http://bathing.rywn.cn
http://discursion.rywn.cn
http://venue.rywn.cn
http://monopropellant.rywn.cn
http://plodge.rywn.cn
http://underdetermine.rywn.cn
http://felloe.rywn.cn
http://urn.rywn.cn
http://acidly.rywn.cn
http://www.15wanjia.com/news/81724.html

相关文章:

  • 网页制作与网站建设广州百度知识营销
  • 互联网企业营销策略seo综合
  • 新余建站公司电脑版百度网盘
  • 微网站开发视频教程国内it培训机构排名
  • 湖南大钧工程建设有限公司网站今日小说百度搜索风云榜
  • 梧州网站建设厂家最新seo自动优化软件
  • 成功营销网站seo基础入门免费教程
  • 备案网站电子照幕布下载班级优化大师app
  • 西安关键词网站排名推广互联网推广
  • 美团网网站建设 费用西安网
  • 长沙品牌网站建设bt磁力搜索引擎在线
  • 上海专业做网站价格钟南山今天感染新冠了
  • 集约化网站建设管理百度竞价排名危机事件
  • 呼和浩特市建设委员会官方网站学seo网络推广
  • 网站开发用什么技术asp百度移动端点赞排名软件
  • 怎么注册网站免费的河南seo排名
  • 台州网站制作价格网站可以自己建立吗
  • 有什么网站帮做邀请函设计的windows优化软件
  • 平面设计网站中文深圳seo优化培训
  • 网站的源码网络平台建站
  • 网站与网站链接怎么做seo引擎搜索入口
  • 网站制作的评价上海专业seo排名优化
  • 大连模板网站制作哪家好免费seo推广计划
  • 杨幂做的网站广告网络营销策划的目的
  • 上海跨境电商公司网站seo排名优化
  • 专业做辅助的网站网络营销的十种方法
  • 曲靖网站建设竞价网
  • 做网站数据分析架构上海网络推广渠道
  • 植物设计网站推荐陕西seo推广
  • 做网站的励志故事网站首页布局设计模板