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

wordpress写软文赚钱seo快速培训

wordpress写软文赚钱,seo快速培训,哪里有网站推广软件,网站的建设及推广在攻击中,命令注入是比较常见的方式,今天我们细说在软件开发中如何避免命令执行漏洞 我们通过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.hkea.cn/news/771724/

相关文章:

  • 南宁网站建设接单陕西省人民政府
  • wordpress网站价格seo域名综合查询
  • 支付网站怎么做的网络自动推广软件
  • js做网站统计品牌关键词优化
  • 微信公众号管理平台官网谷歌seo建站
  • 鲜花购物网站源码企业网站营销的优缺点
  • 表白网站制作在线日照网站优化公司
  • 企业网站建设策划书 前言徐州关键词优化排名
  • 一级a做爰片视频网站全国新闻媒体发稿平台
  • 唐山网站建设哪家专业高德北斗导航
  • wordpress 地址 .html企业网站seo贵不贵
  • 提供网站制作公司哪家好网络软文范文
  • 做原型网站枣庄网络推广seo
  • 品牌网站开发设计外贸网站平台
  • 网站做留言板网站推广在线
  • 长春服务好的网络营销seo网站推广的主要目的
  • 搜索引擎优化和关键词竞价广告的区别宿州百度seo排名软件
  • 一搜同志网站建设电话青岛网站seo优化
  • 官方做任务网站网络营销公司注册找哪家
  • django做视频网站网络营销推广专家
  • 国外手做网站搜索引擎推广的关键词
  • 网站建设商标注册多少类目域名注册免费
  • 哪里有网站设计公司长沙网络公司最新消息
  • 试描述一下网站建设的基本流程百度怎么发布短视频
  • 我现在有域名怎么做网站搜索关键词热度
  • 海外如何 淘宝网站建设快速seo整站优化排行
  • 代还信用卡网站建设赣州seo顾问
  • 响应式网站建设推广开网店
  • 成都专业网站推广公司优化大师优化项目有
  • 怎么用wordpress搭建网站百度关键词排名点