3/01/2023

penetration test process

 Penetration testing is the process of identifying and exploiting vulnerabilities in a system or network to assess its security posture. Here are the general steps involved in a penetration testing process:


Planning and reconnaissance: This involves understanding the scope of the penetration test, defining objectives, and gathering information about the target system or network.

Scanning: In this step, the penetration tester uses automated tools to scan the target system or network for vulnerabilities.

Enumeration: In this step, the tester manually investigates the target system or network to identify potential attack vectors.

Vulnerability analysis: The tester analyzes the results of the scanning and enumeration steps to identify and prioritize vulnerabilities based on their potential impact and ease of exploitation.

Exploitation: The tester attempts to exploit the identified vulnerabilities to gain unauthorized access to the target system or network.

Post-exploitation: If the tester is successful in gaining access, they may attempt to escalate their privileges, maintain access, and exfiltrate sensitive data.

Reporting: The tester documents their findings and provides a report to the organization outlining the vulnerabilities discovered, the potential impact of each vulnerability, and recommendations for remediation.

Remediation: The organization uses the penetration testing report to remediate the identified vulnerabilities and improve the security posture of the target system or network.


It's worth noting that these steps are not necessarily linear, and a penetration test may involve iterations of these steps to identify and exploit different vulnerabilities.

2/18/2023

Can cloudflare block all kinds of sql injection attack?

Cloudflare provides some protections against SQL injection attacks, but it cannot guarantee to block all types of attacks.

Cloudflare's Web Application Firewall (WAF) includes a set of predefined rules that can help protect against common SQL injection attacks, as well as other types of attacks. These rules can be customized and tuned to the specific needs of your website or application.

However, it is important to note that Cloudflare's WAF is not foolproof and may not catch all types of attacks. There are also advanced and sophisticated SQL injection techniques that may bypass these protections, especially if the attacker specifically targets your website or application.

In addition to using Cloudflare's WAF, it is recommended to take other steps to prevent SQL injection attacks, such as using parameterized queries, input validation, and least privilege access control. Regular security assessments and vulnerability testing can also help identify and address any weaknesses in your application's security.

2/15/2023

企業資安強化項目

當今社會的資訊化程度越來越高,資安問題也日益嚴峻。為了提高企業的資安防護能力,我們建議實施以下強化項目:

首先,企業應該加強員工資安意識的培養。很多資安事件都是由於員工不慎或不知情而引起的,因此企業需要加強資安教育培訓,讓員工熟悉常見的資安攻擊手段和防範措施,增強他們的資安防護意識。

其次,企業應該對系統進行嚴格的訪問控制。訪問控制可以限制未經授權的用戶或設備訪問敏感資料和系統,減少資安風險。此外,企業還可以實現身份驗證、加密傳輸等技術手段來加強系統的安全性。

另外,企業應該建立完善的監控系統,實時監控系統運行狀態和異常行為,及時發現和處理潛在的資安問題。此外,企業還可以建立漏洞管理機制,及時處理系統和應用程序中的漏洞,避免被攻擊者利用。

最後,企業應該定期進行資安風險評估,發現和評估系統和應用程序中的潛在風險,制定相應的風險應對措施,減少資安風險。同時,企業還應該定期進行網絡滲透測試,模擬攻擊者的攻擊行為,發現系統和應用程序中的安全漏洞和弱點,進行修補和加固。

總之,企業的資安防護工作不僅是一個技術問題,還需要從員工資安意識、系統訪問控制、監控和漏洞管理等方面綜合考慮,全方位提高資安防護能力。

2/01/2023

common insecure coding situations

 Here are some common insecure coding situations:

  1. Buffer overflows: Allocating insufficient memory for user input can lead to buffer overflows and allow attackers to execute arbitrary code.
  2. SQL Injection: Failing to properly validate user input when constructing SQL queries can allow attackers to inject malicious SQL commands into the database.
  3. Cross-Site Scripting (XSS): Failing to validate user input when generating dynamic web pages can allow attackers to inject malicious scripts into a web page that can then be executed in the user's browser.
  4. Cross-Site Request Forgery (CSRF): Not protecting forms and other sensitive operations from being executed by unauthorized users can result in attackers tricking users into performing actions they didn't intend to.
  5. Unsecured sensitive data: Storing sensitive data, such as passwords, in plaintext or using weak encryption methods, can make it vulnerable to attacks.
  6. Unvalidated Redirects and Forwards: Failing to validate user input when redirecting or forwarding to a new URL can allow attackers to redirect users to malicious sites.
  7. Inadequate error handling: Not properly handling exceptions and errors can reveal sensitive information and make it easier for attackers to exploit vulnerabilities.
  8. Insecure communication: Not using secure protocols, such as SSL or TLS, to encrypt communication can make it vulnerable to eavesdropping and man-in-the-middle attacks.
  9. Insecure storage: Not properly securing files, directories, and other resources on the server can result in attackers accessing sensitive information or modifying data.
  10. Use of vulnerable libraries: Using libraries with known security vulnerabilities can make the application vulnerable to attacks.

These are just a few common insecure coding situations. It's important to stay informed about the latest security threats and to follow secure coding practices to minimize the risk of security vulnerabilities in your code.

how to find security related bugs in java code

Finding security bugs in Java code requires a systematic approach. Some steps to follow include:

Code review: Manually inspect the code for potential security vulnerabilities, such as buffer overflows, SQL injection, etc.

Static analysis: Use automated tools to scan the code for security issues, such as FindBugs, SonarQube, or Fortify.

Dynamic analysis: Use runtime testing techniques, such as penetration testing or fuzz testing, to identify potential security issues.

Library analysis: Check if any third-party libraries used in the code have known security vulnerabilities and if they have been updated to the latest version.

Keep up-to-date with security advisories and patches: Stay informed about the latest security threats and apply any relevant patches to address security vulnerabilities.

It's also important to follow secure coding practices, such as input validation, error handling, and using secure coding frameworks, to minimize the risk of security bugs in your Java code.

1/31/2023

是否有可以偵測異常登入的開源套件

Yes, there are open-source tools that can detect unusual login activity:

OSSEC: A Host-based Intrusion Detection System (HIDS) that monitors and alerts on unusual login activity.

Suricata: A Network Intrusion Detection System (NIDS) that can detect and alert on unusual login activity.

AIDE: A file integrity monitoring tool that can detect and alert on changes to login-related files.

Snort: A Network Intrusion Prevention System (NIPS) that can detect and alert on unusual login activity.

SELinux: A mandatory access control (MAC) system for Linux that can restrict and log unusual login activity.

These are just a few examples of open-source tools that can be used to detect unusual login activity. It's important to choose a solution that fits your organization's specific security needs and to thoroughly test and evaluate it before deploying it.

如何自動化偵測異常登入

自动检测异常登录的方法如下:

监控系统日志:定期检查系统日志,以查看登录活动的异常情况。

使用访问管理系统:使用访问管理系统(如IAM)来监控帐户的登录行为,并在发现异常情况时发送通知。

使用身份验证服务:使用身份验证服务(如MFA)来确保每次登录都是合法的。

使用安全信息与事件管理(SIEM)系统:使用SIEM系统来分析日志数据,以识别异常的登录行为。

使用人工智能(AI)和机器学习(ML)技术:使用AI和ML技术来分析登录数据,以识别异常的登录行为。

这些技术的使用可以帮助提高系统的安全性,并自动识别异常的登录行为。

如何知道登入行為異常?

以下是确定登录行为异常的方法:

异常的地理位置:如果检测到帐户登录来自异常的地理位置,这可能是一种异常登录的信号。

异常的时间:如果检测到帐户登录的时间与正常时间不符,这也可能是异常登录的信号。

异常的设备:如果检测到帐户登录使用的设备与正常不符,这也可能是异常登录的信号。

异常的登录尝试:如果检测到帐户的登录尝试频率明显增加,这也可能是异常登录的信号。

密码不正确:如果帐户的登录密码不正确,这也可能是异常登录的信号。

最好的做法是使用强大的安全系统,如威胁情报平台,实时监测帐户的登录行为,并在发现异常时及时采取行动。

雙因素認證有可能被破解嗎?

 雙因素認證可以提高帳戶的安全性,但不是100%安全。以下是可能破解雙因素認證的情況:

短信或語音認證碼被劫持:駭客可以通過篡改手機碼來獲取認證碼,這種情況下,雙因素認證就無法提供安全保證。

使用不受信任的設備:如果使用不受信任的設備或網路,雙因素認證可能會被駭客破解。

使用不安全的雙因素認證應用程序:使用不安全的雙因素認證應用程序,如被篡改的手機應用程序,可能會被駭客破解。

因此,雖然雙因素認證是一种很好的安全措施,但也不是绝对安全的。最好的做法是使用安全且可靠的雙因素認證方案,並對網路安全進行定期監控和评估。

如何防止駭客橫向移動攻擊?

 以下是防止橫向移動攻擊的常用措施:

分層網路設計:使用分層網路設計,以限制駭客移動到敏感系統。

雙因素認證:強制使用雙因素認證,以防止駭客使用被盜的凭证。

資料管理:定期監控和分析網路上的資料流量,以便及早發現異常行為。

入侵偵測系統:使用入侵偵測系統(IDS)和入侵防范系統(IPS),以監控網路活動並立即偵測攻擊。

軟體更新:及时更新系统和应用程序,以防止利用已知漏洞的攻擊。

權限管理:實施严格的權限管理,以限制駭客的访问权限。

網路安全政策:制定明确的网络安全政策,并定期培训员工,以确保员工了解如何保护敏感信息。

這些措施可以幫助防止駭客橫向移動,但是您也需要定期監控和更新網路安全程序以保持安全。

使用密碼管理器安全嗎?

密码管理器,例如 1Password,可以提高密码安全,但是也有其他因素需要考虑:

数据加密:确保密码管理器使用高级加密算法加密数据,以防止数据被黑客窃取。

安全设置:确保您使用强密码和多因素身份验证(MFA)以保护您的账户。

公司安全记录:了解该公司的安全记录,看是否有过数据泄露或其他安全问题。

数据储存位置:了解数据是否储存在您信任的位置,以防止数据被泄露。

总的来说,使用密码管理器可以增加密码安全,但是您仍然需要采取其他安全措施以保护您的账户。

密碼多久更換一次才安全

 密码多久更换一次才能确保安全是一个有争议的问题,不同的安全专家可能有不同的意见。但一般来说,下列建议可以作为参考:

每90天更换一次密码:这是一个常见的推荐,旨在避免长期使用同一密码,从而降低被黑客攻击的风险。

使用密码管理器:密码管理器可以帮助您生成强密码并自动储存,因此您不需要频繁更换密码。

特定情况下更换密码:在发生安全事件(例如,数据泄露)或使用被盗账号后,应立即更换密码。

最重要的是,使用复杂、不容易猜测的密码,避免使用相同的密码或与您的个人信息有关的信息(例如生日)作为密码。

如何實施零信任架構

实施零信任架构的一般步骤如下:

身份验证:强制执行多重身份验证,包括用户名/密码、令牌、证书等。

数据分类:将数据分类为不同的保密级别,并且只有经过身份验证的用户才能访问特定级别的数据。

网络隔离:通过防火墙、VPN 等技术对内部网络和外部网络进行隔离,并且只允许经过严格认证的流量。

实时监测:实时监测网络活动,快速识别和响应任何潜在的威胁。

风险评估:定期评估网络安全风险,并采取必要的措施来防范威胁。

这些步骤需要通过现代安全技术,如身份管理、数据加密、防火墙等来实现。在实施零信任架构时,需要经常评估网络安全情况,并对其进行适当的更新和维护。

零信任架構是甚麼

Zero Trust is a cybersecurity concept where access to resources is granted only after stringent verification of the identity and context of the request. This approach assumes that all actors, internal and external, are untrusted by default, and verifies each request before granting access. It aims to provide enhanced security by reducing the attack surface and minimizing the potential damage from a successful breach.

零信任是一种网络安全概念,即在严格验证请求者身份和上下文后才允许访问资源。这种方法假设所有内部和外部参与者都是默认不可信的,并在授予访问权限前对每个请求进行验证。它的目的是通过减少攻击面并最大限度地减少成功侵入所造成的损害,提供更强的安全保障。

2/16/2017

如何刪除screen卡住的tab

send kill command ( Ctrl-a and type :kill )

9/29/2016

如何刪除殭屍 how to clean zombie pid

kill -HUP $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }')

3/10/2014

將 vim 上下左右 改為 類似 arrow key 位置

個人因為常玩遊戲, 比較習慣鍵盤上, 上下左右鍵的位置與感覺, 

最近想將 vim 的 上下左右 (kjhl) 改成那樣, 在 .vimrc加上三行:

noremap i k
noremap k j
noremap j h

Ya, 就可以立即適應

9/25/2013

What is ESP?

ESP(封装安全有效负载),全称Encapsulating Security Payload, IPsec 封装安全负载(IPsec ESP)是IPsec 体系结构中的一种主要协议, IPsec ESP 通过加密需要保护的数据以及在IPsec ESP 的数据部分放置这些加密的数据来提供机密性和完整性。 根据用户安全要求,这个机制既可以用于加密一个传输层的段(如:TCP、UDP、ICMP、IGMP), 也可以用于加密一整个的IP 数据报。封装受保护数据是非常必要的,这样就可以为整个原始数据报提供机密性。

9/22/2013

IP subenet zero 的意思

IP subnet zero 是用來限制router不可使用與class相同的subnet.
 例如: 把一個class b 的network 172.16.0.0/16 subnet細分. 其中一個細分方式係 172.16.0.0/19, 172.16.32.0/19, 172.16.64.0/19.....

而如果第一個subnet 172.16.0.0/19在沒有subnet mask的情形下 (即172.16.0.0) 與它的class network (即172.16.0.0) 相同.

這樣會引起routing上的混亂 --- 如果一個router 上有一個network 172.16.0.0/19, 而它用rip把這個network告訴它的neighbor router. neighbor router就會將所有要送去172.16.0.0 class 的packet送到這個router...... 

以前, RIP是很流行的routing 協議. 但它就沒有把subnet mask放入routing table. 當時亦沒有太多network admin考慮這個問題. (RFC950提到這個問題) Cisco注意到這個問題, 所以在很早以前的IOS已經限制使用subnet zero. 以前cisco router 預設是不可使用 subnet zero (即no ip subnet zero是預設的). network admin要輸入ip subnet zero 才可使用.

從12.0開始, ip subnet zero 是預設(因為已沒有太多人使用不含subnbet mask 的routing 協議). 不過network admin還是可以用no ip subnet zero 來限制使用subnet zero.

 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明 http://www.blogbus.com/coolliang-logs/1864324.html

9/09/2013

快速理解 FECN/BECN (forward explicit congestion notification/backward explicit congestion notification)

在frame relay世界中, 有送端與收端, 想像工廠中生產線上的兩個員工, A and B.

A 會一直作東西給 B, 當 A 發現 要把做好的東西放到機台上時結果擠不進去,

這時候A 就會跟 B 說 FECN : 現在機台很上太多東西了, 會滿出來喔.

相反地, B 會一直拿到 A 做好的東西 再加工, 如果 B 發現機台上太多東西,

就會跟 A 說 BECN, 現在機台上太多東西了, 很塞耶.

當然實際在網路上發生此現象的原因是因為頻寬不足, 或是 link noise太大 之類.