2021年5月13日 星期四

ASP.Net Web Forms網站 掃出 ASP.NET debugging enabled 弱點

 ASP.Net Web Forms網站 掃出 ASP.NET debugging enabled 弱點

解決方法 關掉debugging

在web.config

修改設定為<compilation debug="false"/>

ASP.Net Web Forms網站 掃出 Cookies with missing, inconsistent or contradictory properties 弱點 Cookie without SameSite attribute

 ASP.Net Web Forms網站 掃出 Cookies with missing, inconsistent or contradictory properties 弱點

Cookie without SameSite attribute

原因cookie少了sameSite屬性

解決方法:

修改web.config增加sameStie屬性

增加 <httpCookies sameSite="Strict">設定

然後cookie就會多了一個sameSite的屬性了





ASP.Net Web Forms網站 掃出 Clickjacking: X-Frame-Options header missing 弱點

 ASP.Net Web Forms網站 掃出 Clickjacking: X-Frame-Options header missing 弱點


解決方法:增加X-Frame-Options的HTTP標頭欄位

怎麼加勒?還是修改web.config 

增加以下設定

<httpProtocol>

    <customHeaders>

      <add name="X-Frame-Options" value="SAMEORIGIN" />

    </customHeaders>

  </httpProtocol>


ASP.Net Web Forms網站 掃出 ASP.NET version disclosure 弱點

 ASP.Net Web Forms網站 掃出ASP.NET version disclosure弱點

風險等級:低

Header會出現一個X-ASPNET-Version 告訴你網站是哪個.net framewrok版本

是沒必要的

解決方法:

在web.config加入以下設定值

<System.Web>

 <httpRuntime enableVersionHeader=''false'' />

</System.Web>


加完後Header就不會有X-ASPNET-Version了



ASP.Net Web Forms網站 掃出 Unencrypted __VIEWSTATE parameter 弱點

 有一個舊的ASP.Net Web Forms 網站 掃出了弱點名稱:Unencrypted __VIEWSTATE parameter

風險等級:中

修補方式:

修改Web.config並於<system.web>下添加

<machineKey validation="AES"/> 

改完後VIEWSTATE會變成加密的如下圖








2021年5月11日 星期二

在Mantis 中顯示“真實姓名”

 mantis都只有顯示username雖然有輸入真實姓名但是只有管理者看得到

很難知道回報者到底是誰且還有使用者名稱相似的一直認錯

上網google後 發現需要修改config_inc.php 

加上下面設定就好了

$g_show_realname = ON;


mantis文件參考網址入下

https://www.mantisbt.org/docs/master/en-US/Admin_Guide/Admin_Guide.txt

2021年4月28日 星期三

Install Moxa NPort Real TTY drivers for Linux 5.x.x on Ubuntu 20.04

今天開會同事說安裝Moxa的Nport driver 在Ubuntu 20.04上無法complier

所以我自己下載了一個ubuntu 20.04安裝看看 結果成功了

首先到moxa網站如下網址下載driver

https://www.moxa.com/getmedia/c075914f-6187-4f7f-a1c8-e444389d69e8/moxa-real-tty-drivers-for-linux-5.x.x-driver-v5.0.tgz

解開這個檔案後裡面有一個readme.txt 打開會寫如何安裝driver 然後有一個system Requirement如下所示 所以就照順序每個套件安裝 

System Requirement

    To install this driver, you will need NPort Server and one of the
    following system.

     -  kernel 3.0 or above and the kernel source package
     -  gcc-2.7.2.1 or above
     -  ld.so-1.7.14 or above
     -  libc.so-5 or above
     -  binutils-2.7.0 or above
     -  make-3.74 or above
     -  gunzip-1.2.4 or above
     -  gawk-3.1.1.9 or above
     -  openssl-1.0.0 or above (For Secure Real COM Mode only)
     -  libssl-dev-1.0.0 or above (For Secure Real COM Mode only)
     
    Additional requirements for Raspbian
     -  gcc-4.8.3 or above
     -  ncurses-devel-5.9 or above
     -  rpi-source, read the instruction from it's website.

    

1.先安裝Ubuntu 20.04

2.然後安裝gcc 指令如下
sudo apt update
sudo apt install build-essential

3.安裝
libc.so
指令如下
sudo ln -s /lib64/x86_64-linux-gnu/libc.so.6 /lib64/libc.so.6

4.安裝binutils指令如下
sudo apt-get update -y

sudo apt-get install -y binutils-common

5.安裝make指令如下
sudo apt-add-repository ppa:ubuntu-desktop/ubuntu-make 

sudo apt-get update 

sudo apt-get install ubuntu-make 


6.安裝gunzip指令如下

sudo apt-get update -y

sudo apt-get install -y gzip


7.安裝gawk 指令如下
sudo apt-get update -y

sudo apt-get install -y gawk


8.安裝openssl指令如下(nport 6系列才有用)

sudo apt update

sudo apt install openssl

9.安裝libssl指令如下(nport 6系列才有用)

sudo apt install libssl-dev


10.安裝ncurses-devel (樹莓派才需要)
Sudo apt install ncurses-devel

ncurses-devel


11.重新開機
reboot

12.安裝Nport Real TTY drivers for Linux 5.x.x
解壓縮到moxa目錄 cd到 moxa目錄執行
sudo ./mxinst


然後出現如下字串安裝成功
===============================================================================
Installation process is completed.
The all driver files are installed on /usr/lib/npreal2/driver.
Now you can cd /usr/lib/npreal2/driver and run ./mxaddsvr to add tty port.
===============================================================================

安裝過程截圖如下