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

如何对网站的图片做cdn长春关键词优化排名

如何对网站的图片做cdn,长春关键词优化排名,做安居客网站需要什么浏览器,网站报纸什么软件做在攻击中,命令注入是比较常见的方式,今天我们细说在软件开发中如何避免命令执行漏洞 我们通过DVWA中不同的安全等级来细说命令执行漏洞 1、先调整DVWA的安全等级为Lower,调整等级在DVWA Security页面调整 2、在Command Injection页面输入127.0.0.1&…

在攻击中,命令注入是比较常见的方式,今天我们细说在软件开发中如何避免命令执行漏洞

我们通过DVWA中不同的安全等级来细说命令执行漏洞

1、先调整DVWA的安全等级为Lower,调整等级在DVWA Security页面调整

2、在Command Injection页面输入127.0.0.1&whoami 点击提交

这里返回是ping Ip的响应时间和当前登录系统的用户,说明后面的whoami命令已经执行了,这样就是存在命令执行漏洞,我们看看这个地方源码是怎么写的,

我们点击View Source,获取源代码,进行代码分析

代码分析:

<?phpif( isset( $_POST[ 'Submit' ]  ) ) {// Get input$target = $_REQUEST[ 'ip' ];// Determine OS and execute the ping command.if( stristr( php_uname( 's' ), 'Windows NT' ) ) {// Windows$cmd = shell_exec( 'ping  ' . $target );}else {// *nix$cmd = shell_exec( 'ping  -c 4 ' . $target );//shell_exec通过shell环境执行命令,并且将完整的输出以字符串的方式返回}// Feedback for the end userecho "<pre>{$cmd}</pre>";
}?>

3、在DVWA Security页面将安全等级调整为Medium ,我们在执行命令

执行127.0.0.1&&whoami出现信息不返回的情况

执行127.0.0.1&whoami信息还是可以返回,说明命令执行漏洞还在

代码分析:

<?phpif( isset( $_POST[ 'Submit' ]  ) ) {// Get input$target = $_REQUEST[ 'ip' ];// Set blacklist$substitutions = array('&&' => '',';'  => '',//这里只是将 && 和;这2种字符进行了删除);// Remove any of the characters in the array (blacklist).$target = str_replace( array_keys( $substitutions ), $substitutions, $target );// Determine OS and execute the ping command.if( stristr( php_uname( 's' ), 'Windows NT' ) ) {// Windows$cmd = shell_exec( 'ping  ' . $target );//shell_exec通过shell环境执行命令,并且将完整的输出以字符串的方式返回}else {// *nix$cmd = shell_exec( 'ping  -c 4 ' . $target );}// Feedback for the end userecho "<pre>{$cmd}</pre>";
}?>

4、在DVWA Security页面将安全等级调整为High  ,我们在执行命令

执行127.0.0.1&whoami出现信息不返回的情况,说明&符合的漏洞已经修复

执行127.0.0.1|whoami信息还是可以返回,说明命令执行漏洞还在

代码分析:

<?phpif( isset( $_POST[ 'Submit' ]  ) ) {// Get input$target = trim($_REQUEST[ 'ip' ]);// Set blacklist$substitutions = array('&'  => '',';'  => '','| ' => '','-'  => '','$'  => '','('  => '',')'  => '','`'  => '','||' => '',//这里只是将上面9中字符进行拦截和删除。删除命令中的"| " 不是"|",多一个空格);// Remove any of the characters in the array (blacklist).$target = str_replace( array_keys( $substitutions ), $substitutions, $target );// Determine OS and execute the ping command.if( stristr( php_uname( 's' ), 'Windows NT' ) ) {// Windows$cmd = shell_exec( 'ping  ' . $target );//shell_exec通过shell环境执行命令,并且将完整的输出以字符串的方式返回}else {// *nix$cmd = shell_exec( 'ping  -c 4 ' . $target );}// Feedback for the end userecho "<pre>{$cmd}</pre>";
}?>

5、在DVWA Security页面将安全等级调整为Impossible ,我们在执行命令

执行127.0.0.1|whoami将会被拦截。

代码分析:

<?phpif( isset( $_POST[ 'Submit' ]  ) ) {// Check Anti-CSRF tokencheckToken( $_REQUEST[ 'user_token' ], $_SESSION[ 'session_token' ], 'index.php' );// Get input$target = $_REQUEST[ 'ip' ];$target = stripslashes( $target );//去除用户输入的\,防止转移// Split the IP into 4 octects$octet = explode( ".", $target );//把用户输入的数据根据.进行分开,比如127.0.0.1会分开成127 0 0 1// Check IF each octet is an integerif( ( is_numeric( $octet[0] ) ) && ( is_numeric( $octet[1] ) ) && ( is_numeric( $octet[2] ) ) && ( is_numeric( $octet[3] ) ) && ( sizeof( $octet ) == 4 ) ) {//分别判断分开的4个部分是不是数字,如果有不是数字的直接不允许访问// If all 4 octets are int's put the IP back together.$target = $octet[0] . '.' . $octet[1] . '.' . $octet[2] . '.' . $octet[3];//把验证完是数字的4部分在用.拼接起来// Determine OS and execute the ping command.if( stristr( php_uname( 's' ), 'Windows NT' ) ) {// Windows$cmd = shell_exec( 'ping  ' . $target );}else {// *nix$cmd = shell_exec( 'ping  -c 4 ' . $target );}// Feedback for the end userecho "<pre>{$cmd}</pre>";}else {// Ops. Let the user name theres a mistakeecho '<pre>ERROR: You have entered an invalid IP.</pre>';}
}// Generate Anti-CSRF token
generateSessionToken();?>

http://www.dt0577.cn/news/57042.html

相关文章:

  • mysql动态网站开发新闻热点素材
  • 宣传片制作要求说明seo整站优化方案
  • 深圳的网站建设公司哪家好免费涨粉工具
  • 北京理工大学网站开发与应用石家庄seo排名公司
  • 扬州市建设局网站百度网站免费优化软件下载
  • 提供邯郸做wap网站公司做网站推广
  • 烟台网站制作设计烟台seo
  • 网站建设制作需要多少钱企点下载
  • 招聘工作的网站有哪些搜狗搜索排名优化
  • 网页升级维护每天更新谷歌搜索引擎seo
  • 网站制作公司哪里好深圳互联网公司排行榜
  • 网站建设收费标准渠道大数据营销的概念
  • 网站建设行业解决方案线上销售的方法和技巧
  • 房地产销售人员网站怎么做百度贴吧官网网页
  • wordpress纯净版下载沈阳seo网站推广
  • 怎样做google网站系统优化app
  • 创建免费网站的步骤今天最新的新闻头条新闻
  • 做的网站怎么让别人也能看到免费网站安全软件大全
  • 做代刷主站网站百度营销推广登录平台
  • 免费网站建站工具郑州竞价托管代运营
  • 怎样临沂网站建设正规seo关键词排名网络公司
  • 自己做的网站改变字体免费推广的平台都有哪些
  • 西安手机网站建设公司排名小程序开发哪家好
  • 如何做网课网站百度风云排行榜
  • 布吉网站建设价格中国搜索引擎
  • 网站开发与应用 论文汕头百度推广公司
  • 现在个人做网站或者app还有收益苏州seo快速优化
  • 网站备案幕布怎么做自媒体推广渠道
  • 电子商务毕设做网站怎么让百度搜索靠前
  • 做网站是不是太麻烦了广州市新闻最新消息