亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

故意故意對頁面進行編碼

故意故意對頁面進行編碼

C#
九州編程 2021-04-08 14:06:53
我正在嘗試編寫一個故意易受命令注入攻擊的頁面。這是針對培訓環境的。這是我到目前為止的代碼:public ActionResult CommandInjection()    {        string domain = Request.QueryString["domain"];        ViewBag.Domain = domain;        ProcessStartInfo psi = new ProcessStartInfo("nslookup.exe", domain)        {            UseShellExecute = false,            CreateNoWindow = true,            RedirectStandardOutput = true        };        var proc = Process.Start(psi);        string result = proc.StandardOutput.ReadToEnd();        ViewBag.Msg = "This page is vulnerable to Command Injection";        ViewBag.Result = result;        return View();    }看到正常的域查詢請求時,它似乎運行良好。但是,當它看到這樣的請求時:http://localhost:50159/Home/CommandInjection?domain=www.google.com+%26+dir 它返回一個空白。我期望的是它將返回域查找的結果,然后返回dir命令的輸出。C#
查看完整描述

2 回答

?
慕運維8079593

TA貢獻1876條經驗 獲得超5個贊

在這種情況下,用腳拍自己的腳不是那么容易,但是您可以像這樣:


ProcessStartInfo psi = new ProcessStartInfo("cmd.exe", "/c \"nslookup.exe " + domain + "\"")

{

    UseShellExecute = false,

    CreateNoWindow = true,

    RedirectStandardOutput = true

};


查看完整回答
反對 回復 2021-04-10
  • 2 回答
  • 0 關注
  • 144 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號