rainit2006 / Anything

0 stars 0 forks source link

安全管理 #21

Open rainit2006 opened 4 years ago

rainit2006 commented 4 years ago

rainit2006 commented 4 years ago

rainit2006 commented 4 years ago

2019年5月13日,国家市场监督管理总局、国家标准化管理委员会召开新闻发布会,等保2.0相关的《信息安全技术网络安全等级保护基本要求》、《信息安全技术网络安全等级保护测评要求》、《信息安全技术网络安全等级保护安全设计技术要求》等国家标准正式发布,将于2019年12月1日开始实施。

ーーーーーーーーーーーーー 网络安全等级保护2.0(简称等保2.0)核心标准(《信息安全技术 网络安全等级保护基本要求》、《信息安全技术 网络安全等级保护测评要求》、《信息安全技术 网络安全等级保护安全设计技术要求》)正式发布,12月1日起实施。

2 等保2.0正式公开发布 10个问题详细解答

https://zhuanlan.zhihu.com/p/65623386

2 等保测评

等级保护2.0涉及范围为:凡是在中华人民共和国境内建设、运营、维护和使用的基础网络、信息系统、关键基础设施,其等级为第二级及以上的企事业单位都需要开展等级保护工作。

测评包括差距测评出整改清单--整改--复评出测评报告--提交相关监管部门。而这几步中,只有整改部分是公司本身可以进行修改的,也可以寻找第三方合作。其他测评、测评报告都是需要具备等保测评资质的机构来开展的。

3 什么样的公司/单位具备信息安全等级保护测评资质?

该单位至少具有该省市信息安全等级保护协调小组办公室发放的《信息安全等级保护测评机构推荐证书》,同时部分省份要求测评机构在用户单位所在地级市公安网安部门备案,备案成功后方可在当地开展等级保护测评工作。 其外,还可以通过CNAS、ISO9000、27001、信息安全服务资质、各级网络安全应急支撑单位等证书来判断该测评机构的实力。

rainit2006 commented 4 years ago

网络等级:五级 信息系统安全保护等级:五级

rainit2006 commented 4 years ago

ISO27001 https://www.iso27001-isms.com/

クラウドサービス関連: ISO27017、ISO27018 ISO/IEC 27017は、クラウドサービスに関する情報セキュリティ管理策のガイドライン規格です。 ISO27001単体で実施した各種の対策に加え、個人情報に特化した対策を追加で検討・実施することで、パブリッククラウドにおける個人情報保護体制を構築します。

SOCレポート(SOC1,2,3) SOC(System and Organization Controls)受託会社の内部統制に関する3種類の報告書。 SOC报告2011年才有,分为三种类别,其中SOC2标准正在成为金融场景下的重要评判标准。它包含了安全性(Security),可用性(Availability),处理完整性(Processing Integrity),保密性(Confidentiality)和隐私性(Privacy)五项原则。

ISO/IEC 15408 (Common Criteria)  CC (Common Criteria) とは、情報技術セキュリティの観点から、情報技術に関連した製品及びシステムが適切に設計され、その設計が正しく実装されていることを評価するための国際標準規格です。

政府機関等の対策基準策定のためのガイドライン(平成30年度版) https://www.nisc.go.jp/active/general/kijun30.html https://www.nisc.go.jp/active/general/pdf/guide30.pdf 5.1.2 機器等の調達に係る規定の整備

AI・データの利用に関する契約ガイドライン https://www.meti.go.jp/press/2018/06/20180615001/20180615001.html

AI利用ガイドライン https://www.soumu.go.jp/menu_news/s-news/01iicp01_02000081.html 英訳: https://www.soumu.go.jp/main_content/000658284.pdf

rainit2006 commented 3 years ago

差分隐私 http://qimingyu.com/2017/01/06/%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81%EF%BC%88%E4%B8%80%EF%BC%89/

rainit2006 commented 3 years ago

SELinux: https://github.com/rainit2006/Android-/issues/19

rainit2006 commented 3 years ago

利用Openssl查看证书信息

https://developer.android.com/training/articles/security-ssl openssl s_client -connect wikipedia.org:443 | openssl x509 -noout -subject -issuer 结果是:

depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert High Assurance EV Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 High Assurance Server CA
verify return:1
depth=0 C = US, ST = California, L = San Francisco, O = "Wikimedia Foundation, Inc.", CN = *.wikipedia.org
verify return:1
subject=C = US, ST = California, L = San Francisco, O = "Wikimedia Foundation, Inc.", CN = *.wikipedia.org
issuer=C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 High Assurance Server CA
rainit2006 commented 3 years ago

API key

アクセスキーは、厳密にユーザーを識別しないが緩いアクセス管理をしたい時には有効だ。通常、キーはランダムに生成された英数字であり、クライアントとサーバが同一の秘密鍵を共有し、HTTPヘッダやクエリ文字列に入れて通信し、リクエストを許可する仕組みだ。セキュリティとしては弱いが、サーバ側でキーを無効にすればアクセスができなくなるので、個人情報などを使わないものの必要最小限のアクセス制御をしたい時には使える。

アクセスキーは個人やクライアントを特定しないので、それだけでは多くのユースケースに対応できない。アクセスキーを誰かに渡せば、誰でもアクセスできてしまう。そこで、個人を特定して認証・認可するにはトークン技術が有効だ。 ## Token トークンを使えばステートレスにできるのでセッション情報をサーバで保持する必要がない。トークンは認証と認可を分離できるので、(1)クライアントがIDとパスワードを送付し、(2)アイデンティティプロバイダー(IdP)がIDを認証して認証されたクライアントに対してアクセストークンを発行し、(3)クライアントがAPIサーバに対してアクセストークンを付けてリクエストを送付する――ことができる。 https://japan.zdnet.com/article/35126144/ ## CSRF https://zhuanlan.zhihu.com/p/37293032 ``` 方法:使用token来代替验证码验证。由于黑客并不能拿到和看到cookie里的内容,所以无法伪造一个完整的请求。基本思路如下: 服务器随机产生token(比如把cookie hash化生成),存在session中,放在cookie中或者以ajax的形式交给前端。 前端发请求的时候,解析cookie中的token,放到请求url里或者请求头中。 服务器验证token,由于黑客无法得到或者伪造token,所以能防范csrf ```
rainit2006 commented 3 years ago

Burp suite

https://www.youtube.com/watch?v=G3hpAeoZ4ek

https://jaw33sh.wordpress.com/2020/11/22/burp-suite-vs-owasp-zap-a-comparison-series/

DVWA

DVWAはPHP,MySQLで構築された脆弱性のあるWebアプリケーションで、 SQLインジェクションやXSS(クロスサイト・スクリプティング)のテスト用に使われます。

rainit2006 commented 3 years ago

gitleaks工具

https://github.com/zricethezav/gitleaks Gitleaks is a SAST tool for detecting hardcoded secrets like passwords, api keys, and tokens in git repos.

gitleaks -v --repo-url=https://github.com/xxx/<repo name> --access-token=<your token> 显示出所有repos的名字: curl -u <your name>:<your token> -s "https://api.github.com/orgs/xxxx/repos?per_page=200&type=all"|jq '.[].name'

rainit2006 commented 3 years ago

Security tool

Java decompiler工具直接打开文件,选择转换后的jar文件(比如:temp.jar)就好了。


* IDA Pro

* Github code scanning工具
* Sonar
    * Sonar是一个用于代码质量管理的开源平台,用于管理Java源代码的质量。通过插件机制,Sonar 可以集成不同的测试工具,代码分析工具,以及持续集成工具,比如pmd-cpd、checkstyle、findbugs、Jenkins。
* Sonarqube:
    *  https://zhuanlan.zhihu.com/p/38883109
    *  https://blog.tagbangers.co.jp/ja/2019/09/30/sonar_analytics (静的コード解析 Sonar ってなに?)

* Nessus
* OWASP ZAP
    * https://github.com/zaproxy/zaproxy
    * https://www.pupha.net/archives/1358/
        * 静的スキャン (非破壊的スキャン)(Passive Scan)
                * ブラウザの設定でOWASP ZAPをプロキシとして手動でWebアプリケーションにアクセスした時や、スパイダー検索した時にバックグラウンドでこのスキャンが実行されます。
                * 読み取ったHTTPリクエスト・レスポンスの内容をチェックして脆弱性の可能性があるかどうか判断します。
        * 動的スキャン (破壊的スキャン)(Active Scan)
    * https://www.pupha.net/archives/1370/
        * 使い方1:ローカル・プロキシとしてブラウザの通信内容をチェックする
        * 使い方2:簡易的な自動脆弱性検査を行う

* nmap
    * sudo nmap -sS -vv -Pn -p443,2000,5060,30080 link-pro-v23.japancv.org
    * nmap -sT -vv -Pn -n -p 0-65535 192.168.137.196
    * nmap -sU -vv -Pn -n -p 0-65535 192.168.137.196

* Chrome SwitchyOmega
    * この拡張機能を使用すると、特定のルールにマッチしたサイト・ページのみ、プロキシ経由でアクセスできます。

* Openssl 可以打开cert文件的内容
    *  openssl x509 -text -noout -in /[FilePath]/[CertFile]
    * 設定ファイルは/usr/local/etc/openssl/openssl.cnf
    * Cert文件的验证也很重要:openssl verify 文件名
    * openssl rsa -noout -text -in priveteKey.key  |fgrep Private-Key
    * 

■添加证书到Andorid的Trust Credentials列表里:
https://aboutssl.org/how-to-create-and-import-self-signed-certificate-to-android-device/
1. Create an auxiliary file “android_options.txt” with the following lines inside:
    1. basicConstraints=CA:true
    2. extendedKeyUsage=TLS Web Server Authentication, TLS Web Client Authentication, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Server Gated Crypto, Microsoft Encrypted File System, Netscape Server Gated Crypto
    3. basicConstraints=CA:TRUE
2. Create self-signed certificate using these commands:
    1. openssl genrsa -out priv_and_pub.key 2048 -sha256
    2. openssl req -new -days 3650 -key priv_and_pub.key -out CA.pem -sha256
    3. openssl x509 -req -days 3650 -in CA.pem -signkey priv_and_pub.key -extfile ./android_options.txt -out CA.crt -sha256
3. openssl x509 -inform PEM -outform DER -in CA.crt -out CA.der.crt
4. Cat priv_and_pub.key CA.crt > CA.pem ,  然后拷贝到.mitmproxy目录下,执行

* 关于端口号
    * Port:tcp/2000 and tcp/5060
        * VPN server有关
        * https://forum.fortinet.com/tm.aspx?m=186127
    *   Port:30080
        * K8s monitor用

* Kali Linux
* apk常见加固方式
    * 1)代码层级加密--代码混淆:代码混淆工具proguard
    * (2) Dex文件加密
    * 代表厂家: 
        * dexguard(https://www.guardsquare.com/en/products/dexguard)
        * 娜迦(http://www.nagain.com/)
        * app加固厂商:梆梆、爱加密、娜迦,360、阿里
        * 
* tcpdump
    * https://qiita.com/tossh/items/4cd33693965ef231bd2a
    * 设置过滤,排除内部通信
        * tcpdump -l -i eth0 -nn src net not 10.3.0.0/16 and src net not 100.100.0.0/16 and dst port not 10245 and dst port not 10246 and dst port not 10247 and dst port not 10248 and dst port not 10249 and dst port not 10250 and dst port not 10254 and dst port not 10256 and dst port not 22 and dst port not 30080 and dst port not 30776 and dst port not 30777 and dst port not 32722 and dst port not 33471 and dst port not 36973 and dst port not 40080 and dst port not 43380 and dst port not 443 and dst port not 47000 and dst port not 49689 and dst port not 49814 and dst port not 52810 and dst port not 57594 and dst port not 58080 and dst port not 59365 and dst port not 80 and dst port not 8181 and dst port not 9100 and dst xx.xx.xx.xx
* netstat 命令
    * sudo netstat -tnlp
* CASB
    * 2021年4月に運用開始を目指して進行中。
    * 現在最も有力なのはNetskope(ユーザあたり1600円~)、しかしSBCのAPIは対象外。
    * Cisco CloudlockもSBCは対象外。SBエンジニアリング経由でMacfee CASBも確認中。
    * Alibaba Cloud対応のWork load Protectionのツールを検索する。
* Tcpdump
    * $ tcpdump -nnn -t -c 200 | cut -f 1,2,3,4 -d '.' | sort | uniq -c | sort -nr | head -n 20
    * Package 内容:
        * タイムスタンプ
        * IP (?)
        * 送信元 (IP アドレスとポート)
        * 送信先 (IP アドレスとポート)
        * フラグ (ACK, SYN, FIN など。どれも立っていなければ “.”)
        * seq (シーケンス番号)
            * “1:1401” のような表記の場合は “開始シーケンス番号:終了シーケンス番号” という意味
        * ack (ACK 番号)
        * win (ウィンドウサイズ)
        * blacket に囲まれている部分はその他オプション
        * length (送信バイト数)
* 查看某个ip的国家和公司
    * curl -s http://ipwhois.app/json/18.208.54.140 | jq -r '.country'
    * curl -s http://ipwhois.app/json/18.208.54.140 | jq -r '.org'
    * curl -s http://ipwhois.app/json/${ip}
    * curl -s http://ipwhois.app/json/${ip} | jq -r '.country, .region, .org’

### Clair
- Clair is an open source project for the static analysis of vulnerabilities in application containers (currently including OCI and docker).

### lynis
https://github.com/CISOfy/lynis
Lynis is a security auditing tool for systems based on UNIX like Linux, macOS, BSD, and others. It performs an in-depth security scan and runs on the system itself. The primary goal is to test security defenses and provide tips for further system hardening. It will also scan for general system information, vulnerable software packages, and possible configuration issues. Lynis was commonly used by system administrators and auditors to assess the security defenses of their systems. Besides the "blue team," nowadays penetration testers also have Lynis in their toolkit.
rainit2006 commented 3 years ago

密钥硬编码 https://www.zhihu.com/column/p/24279535

rainit2006 commented 3 years ago

CIS Benchmarks

CIS Benchmarks™は、米国のCIS(Center For Internet Security)(注1)が発行しているシステムを安全に構成するための構成基準およびベストプラクティスが記載されたガイドラインです。CIS Benchmarksの対象は、Windows ServerやRed Hat Enterprise LinuxなどのOS、ApacheやDocker、Oracle DBなどのミドルウェア、CiscoやPalo Alto Networksなどの主要ベンダーのネットワークデバイス、その他デスクトップソフトウェアやモバイルデバイス等と幅広く、現在140種類以上のベンチマークが発行されています。それぞれの対象のバージョンごとに、システムをセキュアにするための設定方法が記載されているのが特徴です。また、Amazon Web Services(以降AWS)やMicrosoft Azure(以降Azure)などのクラウドプロバイダを利用する場合のベンチマークも提供されています。 CIS全名Center for Internet Security,是一个美国的第三方安全组织,他们致力于采用线上社区的模式与大公司、政府机构、学术机构一起打造优秀的安全实践解决方案(各种benchmarks),详情可以参见维奇百科(注2)。当前各个公司发布的Linux操作系统大多都已经提供CIS benchmark和CIS Hardened image,包括CentOS、Ubuntu、Windows等,详情可以参见CIS网站(注3)。当前发布CIS benchmark已经成为很多阿里云客户对于OS安全的重要评判依据之一。

https://www.cisecurity.org/cis-benchmarks/ https://jpn.nec.com/cybersecurity/blog/200522/index.html

rainit2006 commented 3 years ago

Mobile APP security tools

Simulator:

rainit2006 commented 3 years ago

搭建VPN