https://www.netsparker.com/blog/web-security/ldap-injection-how-to-prevent/

 

What is LDAP Injection and How to Prevent It

LDAP injection attacks exploit input validation vulnerabilities to inject and execute queries to Lightweight Directory Access Protocol servers. This article looks at how LDAP injection works and shows how it can be prevented to improve web application secu

www.netsparker.com

 

LDAP injection attacks exploit input validation vulnerabilities to inject and execute queries to Lightweight Directory Access Protocol servers. By supplying specially constructed user inputs to a vulnerable application, attackers can extract potentially sensitive information from an organization’s LDAP directory. LDAP services are crucial for the daily operation of many organizations, and a successful LDAP injection attack can provide valuable information for further attacks on systems and applications. In this article, we will look at how LDAP injection works and see how it can be prevented to improve web application security.

 

The Importance of LDAP Servers

The Lightweight Directory Access Protocol, or LDAP, is an open application protocol for accessing and maintaining directory services in an IP network (see RFC 4511 for the specification). Organizations typically store information about users and resources in a central directory (such as Active Directory), and applications can access and manipulate this information using LDAP statements. In effect, LDAP servers are a gateway to a wealth of sensitive information, including user credentials, staff names and roles, shared network resources device and so on. Although less publicized than SQL injection attacks, LDAP injection attacks can yield valuable information about an organization’s internal infrastructure and potentially even provide attackers with access to database servers and other internal systems.

LDAP Statement Syntax

Clients can query an LDAP server by sending requests for directory entries that match specific filters. If entries are found that match the LDAP search filter, the server returns the requested information. Search filters used in LDAP queries follow the syntax specified in RFC 4515 (originally RFC 2254). Filters are constructed from any number of LDAP attributes specified as key-value pairs in parentheses. Filters can be combined using logical and comparison operators and can include wildcards. Here are a few examples:

  • (cn=John*) matches entries where the common name starts with John (* matches any character)
  • (!(cn=*Doe)) matches entries where the common name doesn’t end with Doe (! is logical NOT)
  • (&(cn=J*)(cn=*Doe)) matches entries where the common name starts with J and ends with Doe (& is logical AND)
  • (&(|(cn=John*)(cn=Jane*))(cn=*Doe)) matches entries where the common name starts with John or Jane and ends with Doe (| is logical OR)

Multiple filters and operators are combined using prefix notation (Polish notation), with arguments following the operator. For a full description of LDAP search filter syntax, see RFC 4515.

How LDAP Injection Works

As with SQL injection and related code injection attacks, LDAP injection vulnerabilities occur when an application inserts unsanitized user input directly into an LDAP statement. By crafting suitable string values using LDAP filter syntax, attackers can cause the LDAP server to execute a variety of queries and other LDAP statements. If combined with misconfigured or compromised permissions, LDAP injections may allow attackers to modify the LDAP tree and tamper with business-critical information.

While LDAP injections come in many shapes and sizes, here are two typical approaches:

  • Authentication bypass: Directory services are commonly used for user authentication and authorization, so the most basic LDAP injection attacks attempt to bypass password checking. Take the following vulnerable JavaScript code that directly assembles a simple LDAP filter from user inputs stored in the variables enteredUser and enteredPwd:For non-malicious users, the resulting filter should be something like:If this query is true, the user and password combination exists in the directory, so the user is logged in. However, an attacker can enter LDAP filter code as the user ID (shown in red) to create a filter that is always true, for example:This can allow the attacker to gain access without a valid user name or password.
  • (&(userID=*)(userID=*))(|(userID=*)(password=anything))
  • (&(userID=johndoe)(password=johnspwd))
  • filterContent = "(&(userID=" + enteredUser + ")(password=" + enteredPwd + "))"
  • Information disclosure: If a vulnerable application uses LDAP filters to provision shared resources, for example printers, an attacker performing recon might inject LDAP filter code to list all resources in the organization’s directory. Let’s say the following filter intended to list printers and scanners is assembled in an unsafe way:If the attacker can enter another value instead of printer and knows that userID is used for user names in the directory, they might inject the following code:This will list all printer and user objects, and the scanner part will be ignored by the server (only the first complete filter is processed).
  • (|(resType=printer)(userID=*))(resType=scanner))
  • (|(resType=printer)(resType=scanner))

Blind LDAP Injection

To directly query an LDAP server, the attacker needs to know (or guess) the attribute names so they can be specified in a filter. Blind LDAP injection is a more advanced exploitation technique for extracting unknown information by sending multiple requests and checking server responses to determine if the query is valid. Combined with additional optimizations and automation, this allows attackers to obtain information using a series of yes/no questions: a valid server response means “yes”, and a server error means “no”. Effective blind injection attacks typically involve several steps:

  • Attribute discovery: Attackers can query a variety of likely attributes and monitor server responses. If an attribute exists, the server will return a valid response. Otherwise, an error or empty response is returned. Let’s say an application unsafely constructs an AND filter to retrieve users, such as:If the attacker can manipulate the user ID value, they can inject code like the following to check if user objects in this directory have a department attribute:If the department attribute exists (and John Doe is a valid user ID), the server will return a valid response. Otherwise, the attacker can try other attribute names.
  • (&(userID=John Doe)(department=*))(objectClass=user))
  • (&(userID=John Doe)(objectClass=user))
  • Booleanization: Once an attribute name is known, the attacker can send a series of requests containing wildcards and/or comparison operators to determine specific attribute values. Again, only two server responses are considered, so booleanization is the process of transforming the search process into a series of true/false tests.
    (&(userID=John Doe)(department=a*))(objectClass=user))
    A valid server response means that a department starting with the letter “a” exists. The attacker can continue the process for ab*, ac*, and so forth, to discover subsequent characters. For numeric values, the operators <= (less than or equal to) and >= (greater than or equal to) can be used to go through the likely value space.
  • Let’s say the department attribute from the previous example exists. To discover the department name, the attacker can start by injecting the following code to check the first letter:
  • Character set reduction: To minimize the number of requests, attackers can use multiple wildcards to find out which characters are present anywhere in the target value. For example, a valid server response for the following injection:means that a department name containing the letter “x” exists. If an error or empty response is returned, the attacker can eliminate this character from the scan. This can greatly reduce the number of requests needed to find the target value.
  • (&(userID=John Doe)(department=*x*))(objectClass=user))

Preventing LDAP Injection in Web Applications

As with many other injection attacks, proper input validation and encoding in the application layer is critical to eliminate LDAP injection vulnerabilities. Every user input that might be used within LDAP queries should be sanitized according to application requirements and encoded to ensure that any remaining LDAP special characters are safely escaped, including at least ( ) ! | & *. The OWASP cheat sheet has more detailed information about escaping techniques. For maximum security and convenience, a ready framework or library should be used for escaping special characters and assembling LDAP filters.

 

 

 

'경로 및 정보' 카테고리의 다른 글

bug bounty epub  (0) 2022.03.18
Pyinstaller Decom  (0) 2022.01.29
WinDbg 6.12 버전  (0) 2022.01.20
Sonarqube 소스 분석 및 owasp top 10 점검  (0) 2022.01.19
노트패드 \r\n 개행  (0) 2022.01.17
블로그 이미지

wtdsoul

,

 

WinDbg 6.12.0002.633 Standalone Download

 

'경로 및 정보' 카테고리의 다른 글

Pyinstaller Decom  (0) 2022.01.29
Netsparker LDAP 인젝션  (0) 2022.01.20
Sonarqube 소스 분석 및 owasp top 10 점검  (0) 2022.01.19
노트패드 \r\n 개행  (0) 2022.01.17
nmap script nse 스캐닝  (0) 2021.12.29
블로그 이미지

wtdsoul

,

https://www.sonarqube.org/downloads/?gads_campaign=Asia-SonarQube&gads_ad_group=SonarQube&gads_keyword=sonarqube&gclid=EAIaIQobChMIp-ng4d289QIVzkNgCh2ziQhkEAAYASAAEgKybfD_BwE

 

Download | SonarQube

Get the latest LTS and version of SonarQube the leading product for Code Quality and Security from the official download page.

www.sonarqube.org

 

 

확인이 필요함

'경로 및 정보' 카테고리의 다른 글

Netsparker LDAP 인젝션  (0) 2022.01.20
WinDbg 6.12 버전  (0) 2022.01.20
노트패드 \r\n 개행  (0) 2022.01.17
nmap script nse 스캐닝  (0) 2021.12.29
win10 jdk 설치  (0) 2021.12.23
블로그 이미지

wtdsoul

,

https://mainia.tistory.com/6264

 

노트패드++(Nodepad++) 개행문자, 줄바꿈, 라인피드, 캐리지리턴을 텍스트에서 간단하게 제거하기

노트패드++(Nodepad++) 개행문자, 줄바꿈, 라인피드, 캐리지리턴을 텍스트에서 간단하게 제거하기 환경: Notepad++ 텍스트에서 "개행문자" 란 "줄바꿈문자" 를 말합니다. "라인피드" 는 커서를 한 칸 아

mainia.tistory.com

 

 

노트패드++(Nodepad++) 개행문자, 줄바꿈, 라인피드, 캐리지리턴을 텍스트에서 간단하게 제거하기

 

환경: Notepad++

 

텍스트에서 "개행문자"  "줄바꿈문자" 를 말합니다. "라인피드" 는 커서를 한 칸 아래로 이동해서 새로운 라인을 추가할 때 사용하는 문자입니다. "캐리지리턴" 은 커서를 제일 왼쪽으로 이동합니다. 개행문자는 라인피드 + 캐리지리턴 으로 이루어지는 것입니다. 예를 들어 컴퓨터에서 Enter 키를 누르면 줄바꿈이 이루어집니다. 이것을 개행이라고 합니다. 그런데 사용자 눈에는 보이지 않기 때문에 백스페이스나 Delete 키로 삭제할 수 없습니다. 그래서 노트패드++ 과 같은 텍스트 편집 도구를 이용하는 것입니다.

 

용어를 정리하자면 다음과 같습니다.

l  개행문자 (줄바꿈문자) = 라인피드(LF, Line Feed) + 캐리지리턴(CR, Carrige Return)

l  LF, Line Feed : 아스키 코드 10 -> \r

l  CR, Carrige Return : 아스키 코드 13 -> \n

 

 그림처럼 여러 줄로 이루어진 문자열 끝에는 눈에 보이지 않지만 줄바꿈문자가 들어가 있습니다.

 

 줄바꿈문자를 문자를 제거하고 싶다면 바꾸기 창을 띄웁니다. Ctrl + h 단축키를 이용합니다

 

 줄바꿈 문자를 제거해서 여러 줄로 나누어져 있는 글을 하나로 합쳐보겠습니다. 바꾸기 창의 찾을 내용에 Line Feed  Carrige Return 을 입력합니다. 그리고 아래로 가서 검색 모드를 일반에서 확장으로 바꿉니다

 

 모두 바꾸기 버튼을 눌러 줄바꿈 문자를 모두 제거합니다. 결과는 아래와 같습니다. 여러 줄로 나누어져 있던 것이 한 줄로 합쳐졌습니다

 

 다음은 단어 사이에 있는 공백을 모두 줄 바꿈으로 바꿔보겠습니다. 찾을 내용에 스페이스바를 이용해서 공백을 넣습니다. 그리고 모두 바꾸기 버튼을 클릭합니다

 

 그림처럼 공백이 있는 공간에 줄바꿈문자가 들어가면서 여러 줄이 되었습니다.

 

'경로 및 정보' 카테고리의 다른 글

WinDbg 6.12 버전  (0) 2022.01.20
Sonarqube 소스 분석 및 owasp top 10 점검  (0) 2022.01.19
nmap script nse 스캐닝  (0) 2021.12.29
win10 jdk 설치  (0) 2021.12.23
Interact.sh 경로 건  (0) 2021.12.15
블로그 이미지

wtdsoul

,

https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=wwwkasa&logNo=221114926044

 

nmap 스크립트 NSE로 취약점 스캐닝

nmap에서 제공하는 스크립트 nse를 이용하여 취약점을 스캐닝 할 수 있다. 우선 간단히 정리하면 Nmap scr...

blog.naver.com

 

 

정말 오랜만에 글 작성하는 것 같네요. 매일 정신없이 하루를 보내고, 당분간은 쭉 그럴거 같습니다.. 지난번 nmap 정리에 대한 이야기의 연장선으로 NSE에 대해 잠깐 볼까합니다.

[[HACKING] NMAP Part1 - nmap을 이용한 여러가지 네트워크 스캔 기법(network scan with nmap)](http://www.hahwul.com/2016/03/hacking-nmap-part1-nmap-network-scan.html) 
[[HACKING] NMAP Part2 - NSE(Nmap Script Engine)을 이용한 취약점 스캐닝(Vulnerability scan with NSE Script)](http://www.hahwul.com/2016/03/hacking-nmap-part2-nsenmap-script.html) 

Nmap script 인 NSE는 nmap을 통해 네트워크 스캔을 진행하거나, 취약점 진단을 수행할 때 요긴하게 쓰일 수 있는 스크립트입니다. Lua로 작성되어 있으며 nmap을 통해 포트스캔, 네트워크 접근 이외에도 더 넓은 범위의 체킹이 가능하게 해주는 중요한 도구지요.

NSE(Nmap Script Engine)?

위에서도 대충 설명드렸지만 NSE는 nmap에서 사용되는 script 입니다. lua로 개발되었으며 아래와 같이 5개 카테고리의 script 를 가지고 있습니다.

  1. Network discovery
  2. More sophisticated and accurate OS version detection
  3. Vulnerability detection
  4. Backdoor detection
  5. Vulnerability exploitation

NSE Update & NSE List Check

nse script update는 nmap 사용 시 –script-update, –script-updatedb 옵션으로 업데이트를 진행할 수 있습니다.

#> nmap –script-update #> nmap –script-updatedb

Starting Nmap 6.47 ( http://nmap.org ) at 2016-03-14 12:19 KST NSE: Updating rule database. NSE: Script Database updated successfully. Nmap done: 0 IP addresses (0 hosts up) scanned in 0.51 seconds

위 명령을 수행하면 nmap.org에서 추가된 nse script 를 받아 nmap 디렉토리에 저장하게 되지요. 저장된 nse 파일은 find나 locate 명령으로 찾아볼 수 있습니다.

#> locate *.nse /usr/share/nmap/scripts/acarsd-info.nse /usr/share/nmap/scripts/address-info.nse /usr/share/nmap/scripts/afp-brute.nse /usr/share/nmap/scripts/afp-ls.nse /usr/share/nmap/scripts/afp-path-vuln.nse /usr/share/nmap/scripts/afp-serverinfo.nse /usr/share/nmap/scripts/afp-showmount.nse ..snip..

이제 nse를 사용하기 위한 준비 작업은 끝났습니다.

NSE Use

NSE의 사용은 nmap에서 –script 옵션을 통해 사용이 가능하며 인자값으로 해당 모듈 이름이 들어가게 되면 해당 nse를 사용하여 스캔을 진행합니다.

#> nmap –script ajp-auth

위와 같이 명령 시 ajp 인증 프로토콜에 대해 스캔을 진행합니다. 한번에 여러가지 스크립트를 사용하기 위해 * 등을 통해 규칙을 지정해줍니다.

간단한 예시로 취약성에 대해 스캔하는 모듈을 찾는다고 하면 아래와 같이 locate 명령을 줄 수 있겠지요.

#> locate vul.nse /usr/share/nmap/scripts/afp-path-vuln.nse /usr/share/nmap/scripts/ftp-vuln-cve2010-4221.nse /usr/share/nmap/scripts/http-huawei-hg5xx-vuln.nse /usr/share/nmap/scripts/http-iis-webdav-vuln.nse /usr/share/nmap/scripts/http-vmware-path-vuln.nse /usr/share/nmap/scripts/http-vuln-cve2009-3960.nse ..snip..

또한 nmap에서 스크립트를 사용할때도 동일한 방법으로 가능합니다. #> nmap –script “http-” #> nmap –script “ssh”

Category Scan(Default/Safe/etc..)

위에서는 각각 nse 스크립트를 사용하는 방법에 대해 보았다면 이번에는 좀 더 넓은 범위의 스캔 옵션을 볼까합니다. (귀찮아서 저도 많이 쓰는 옵션이라죠..)

nse에 지정된 category를 통해서 한번에 여러가지 script에 대해 동작을 진행할 수 있습니다. 대표적으로 default 그룹과 safe 그룹등이 있겠네요.

Default Scan Default Scan은 타겟 도메인의 전반적인 항목에 대해 스캔을 수행하는 옵션입니다. –script 옵션에 default를 인자값으로 주게되면 테스트를 진행하게 됩니다.

#> nmap –script=default 127.0.0.1

Starting Nmap 6.47 ( http://nmap.org ) at 2016-03-14 12:21 KST Nmap scan report for 127.0.0.1 Host is up (0.00096s latency). Not shown: 997 filtered ports PORT STATE SERVICE 80/tcp open http |_http-generator: XpressEngine |_http-methods: No Allow or Public header in OPTIONS response (status code 302) | http-title: MAIN

Safe Scan은 Safe 카테고리에 있는 항목들로 구성된 NSE 그룹입니다.

Safe Scan #> nmap –script=safe 127.0.0.1 ..snip..

Traceroute

#> nmap –script-trace

NSE Script List

  1. 설치된 NSE 스크립트. locate 명령으로 쉽게 찾을 수 있습니다. 물론 find 명령으로도 가능하지요 : ) #> locate *.nse
  2. nmap에서 제공하는 nse 스크립트 description & list https://nmap.org/nsedoc/

'경로 및 정보' 카테고리의 다른 글

Sonarqube 소스 분석 및 owasp top 10 점검  (0) 2022.01.19
노트패드 \r\n 개행  (0) 2022.01.17
win10 jdk 설치  (0) 2021.12.23
Interact.sh 경로 건  (0) 2021.12.15
windows 10 텍스트 검색 경로  (0) 2021.12.11
블로그 이미지

wtdsoul

,

win10 jdk 설치

경로 및 정보 2021. 12. 23. 01:29

https://crazykim2.tistory.com/478

 

[JAVA] Window10의 JAVA SE 11 설치하기

안녕하세요 포스팅이 늦은 것 같지만 이번에 윈도우를 포맷하면서 자바를 다시 설치하게 되었습니다 자바 개발을 처음하거나 자바를 설치한지 오래되어서 기억이 안 나는 분들을 위해 자바 설

crazykim2.tistory.com

 

 

'경로 및 정보' 카테고리의 다른 글

노트패드 \r\n 개행  (0) 2022.01.17
nmap script nse 스캐닝  (0) 2021.12.29
Interact.sh 경로 건  (0) 2021.12.15
windows 10 텍스트 검색 경로  (0) 2021.12.11
window search 기능 활성화  (0) 2021.12.10
블로그 이미지

wtdsoul

,

https://www.hahwul.com/2021/10/05/support-interactsh-on-zap-oast/

 

이제 Interact.sh 가 ZAP OAST에서 지원됩니다

최근에 ZAP OAST(Callback 기능)에 projectdiscovery의 Interactsh 지원이 추가되었습니다. 약 2주전에 commit 됬고 저도 인지한지 좀 됬었는데, 이제서야 글로 작성하네요 😁 https://github.com/zaproxy/zap-extensions/com

www.hahwul.com

 

 

'경로 및 정보' 카테고리의 다른 글

nmap script nse 스캐닝  (0) 2021.12.29
win10 jdk 설치  (0) 2021.12.23
windows 10 텍스트 검색 경로  (0) 2021.12.11
window search 기능 활성화  (0) 2021.12.10
shodan 과 비슷한 서비스  (0) 2021.11.05
블로그 이미지

wtdsoul

,

https://positivemh.tistory.com/494

 

텍스트 검색 프로그램 findinfiles 사용법 폴더에서 특정 텍스트 들어간 소스파일 찾기

OS환경 : Windows 10 pro (64bit) 방법 : 텍스트 검색 프로그램 findinfiles 사용법 폴더에서 특정 텍스트 들어간 소스파일 찾기 업무를 하다보면 어떤 파일안에 들어있는 텍스트를 찾아야 할 일이 종종 생

positivemh.tistory.com

 

정상적으로 일단 접근이 안되네...

 

 

업무를 하다보면 어떤 파일안에 들어있는 텍스트를 찾아야 할 일이 종종 생긴다

html 업무 중 특정 클래스 명을 찾는다거나 개발업무 도중 특정 모듈 명을 찾는다거나 등등

그 때 사용하면 좋은 프로그램을 소개한다.

프로그램 이름은 findinfiles 이다

 

 

먼저 프로그램을 다운로드 한다

개발사 홈페이지에 접속

https://toolscode.com/findinfiles/

 

바로 다운로드 하고 싶다면 아래 파일을 설치하면 됨(공식 홈페이지에서 20200129에 다운로드 받은 파일)

findinfiles_win_x64_b272.exe

 

 

상단 Download 버튼 선택

 

 

다운로드를 GitHub에서 제공하고 있음 GitHub 선택

 

 

최신 빌드 다운로드

 

 

다운로드 받은 파일 실행

 

 

Next 선택

 

 

I Agree 선택

 

 

Next 선택

 

 

Install 선택

 

 

설치완료 Finish 선택

 

 

자동으로 프로그램이 실행되는데 일단 X 를 눌러 종료

 

 

소스를 찾으려는 폴더에 오른쪽 마우스를 눌린 뒤 FindInFiles... 선택

 

 

찾을 문자 입력(나의 경우 shutdown 을 입력) 후 찾을 파일 확장자명을 입력

 

 

찾기 버튼 선택 시 shutdown 이라는 단어가 포함된 파일들이 모두 나옴

 

 

'경로 및 정보' 카테고리의 다른 글

win10 jdk 설치  (0) 2021.12.23
Interact.sh 경로 건  (0) 2021.12.15
window search 기능 활성화  (0) 2021.12.10
shodan 과 비슷한 서비스  (0) 2021.11.05
PC용 Epub 뷰어  (0) 2021.10.26
블로그 이미지

wtdsoul

,

https://rgy0409.tistory.com/3309

 

윈도우10 검색안됨 (검색 기능 오류) 해결 방법

윈도우10의 편리한 기능 중 하나인 검색 기능이 때로 오작동 하는 경우가 있다고 합니다. 제 경우는 아직까지는 한번도 그런적이 없었지만, 저도 쓰다보면 언젠가 발생할 수 있는 일이기에 미리

rgy0409.tistory.com

 

 

 

'경로 및 정보' 카테고리의 다른 글

Interact.sh 경로 건  (0) 2021.12.15
windows 10 텍스트 검색 경로  (0) 2021.12.11
shodan 과 비슷한 서비스  (0) 2021.11.05
PC용 Epub 뷰어  (0) 2021.10.26
클라우드 AWS 모의해킹 방법론 (ex. 인포섹)  (0) 2021.08.31
블로그 이미지

wtdsoul

,

https://www.zoomeye.org/searchResult?q=175.196.94.13

 

ZoomEye - Cyberspace Search Engine

 

www.zoomeye.org

 

 

'경로 및 정보' 카테고리의 다른 글

windows 10 텍스트 검색 경로  (0) 2021.12.11
window search 기능 활성화  (0) 2021.12.10
PC용 Epub 뷰어  (0) 2021.10.26
클라우드 AWS 모의해킹 방법론 (ex. 인포섹)  (0) 2021.08.31
하이퍼바이저 개념  (0) 2021.04.06
블로그 이미지

wtdsoul

,