2013년 3월 30일 토요일

php register_globals

전역변수설정

# vim /etc/php5/apache2/php.ini


:/register_globlas
다음에 n키를 눌러 next
검색하여


register_globals = on 으로 변경해 준다.

cookie and session



쿠키
서버측에서 클라이언트측에 상태 정보를 저장하고 추출하는 원리
최초는 서버에서 set-cookie로 설정해 주며 서버는 준 쿠키로 상태를 판별하는 것
방문했던 사이트가 계속 로그인 중일때
팝업 오늘창 다시 보지 않기.

세션
세션이란 클라이언트와 웹서버 간에 네트워크 연결이 지속적으로 유지되고 있는 상태
사용자가 서버에 접속요청을 하게 되면 세션이라는 고유값을 부여 한다.
이는 클라이언트를 구분할 수 있는 고유의 값이 된다. 이를 판단하는것이 쿠키이다.




공통점과 차이점
쿠키는 클라이언트에 저장이 되며 세션은 서버의 상태로 저장된다는 점이 다른다.
쿠키의 경우 서버의 자원을 사용하지 않지만 세션의 경우는 서버에 저장되기 때문에 서버의 자원을 사용한다고 볼 수 있다.









쿠키
저장위치 : 사용자 pc
저장형식 : txt파일
종료 : 브라우져 종료시 보통은 삭제
쿠키 하나당 4 kb

세션
저장위치 : 서버
저장형식 : object
종료 : 알 수 없지만 사용자가 세션을 종료한다고 알려주면 종료 된다.


세션과 쿠키를 만드는 방법

URL encoding



참고한 사이트

아래는 예약된 코드들 입니다.

CharacterCode
Points
(Hex)
Code
Points
(Dec)
 Dollar ("$")
 Ampersand ("&")
 Plus ("+")
 Comma (",")
 Forward slash/Virgule ("/")
 Colon (":")
 Semi-colon (";")
 Equals ("=")
 Question mark ("?")
 'At' symbol ("@")
24
26
2B
2C
2F
3A
3B
3D
3F
40
36
38
43
44
47
58
59
61
63
64


확인하는 방법은 브라우져의 url입력부에다가 해당 심볼을 쳐보면 알 수 있습니다.

URL인코딩은 안전하지 않는 ASCII문자를 대체하여 사용됩니다. 


CharacterCode
Points
(Hex)
Code
Points
(Dec)
Why encode?
Space2032Significant sequences of spaces may be lost in some uses (especially multiple spaces) 스페이스를 %20형식의 방식으로 사용하지 않으면 내용이 날라 갈 수 있으니가 특히 더블 스페이스를 입력했을때 스페이스를 날려버릴 수 있으니까 이러한 코드로 사용한다. 참고로 W3표준에서는 공백을 인정하지 않는다. 즉 공백을 포함할 수 없다. 일반적으로는 공백을 + 기호로 대처한다.
Quotation marks
'Less Than' symbol ("<")
'Greater Than' symbol (">")
22
3C
3E
34
60
62
These characters are often used to delimit URLs in plain text. 구분자로 사용되는 문자로 텍스트로 표현하지 않으면 내용이 전달이 될때 웹어플리케이션이나 서버에서 해석을 하려 들기 때문이다. 그렇게 되면 데이터 파괴 스크립트 실행등의 공격이 될 수 있다. 그래서 텍스트로 인식할 수 있게 자동으로 바꾸는 것이다.
'Pound' character ("#")2335This is used in URLs to indicate where a fragment identifier (bookmarks/anchors in HTML) begins. 시작위치에 표시되는 문자.
Percent character ("%")2537This is used to URL encode/escape other characters, so it should itself also be encoded. 정말 중요한 문자이다. 이 문자는 url인코딩을 들어가느냐 나가느냐를 판단하는 문자로 만약 이 문자가 url에서 입력이 되었을때 그대로 받아 들여 지게 된다면 %이후는 인코딩타입으로 인식하게 된다. 그래서 이걸 순수히 url로 전달할때는 %25 로 변환되어 들어가게 되는것이다. 
Misc. characters:
   Left Curly Brace ("{")
   Right Curly Brace ("}")
   Vertical Bar/Pipe ("|")
   Backslash ("\")
   Caret ("^")
   Tilde ("~")
   Left Square Bracket ("[")
   Right Square Bracket ("]")
   Grave Accent ("`")

7B
7D
7C
5C
5E
7E
5B
5D
60

123
125
124
92
94
126
91
93
96
Some systems can possibly modify these characters.

이러한 문자를 항상 인코딩 해야 하는 이유는 url상에서 해석이 되어 버려서 다양한 문제점을 야기 할 수 있기 때문입니다. 특히 html인코딩과 비슷한 이유에서 이러한 문자들이 문자가 아닌 스크립트를 실행하는 혹은 인젝션을 실행하는 내용일 경우 해당 시스템은 피해를 볼 가능성이 존재하게 됩니다.



URL encoding of a character consists of a "%" symbol, followed by the two-digit hexadecimal representation (case-insensitive) of the ISO-Latin code point for the character.
URL인코딩은 %를 기준으로 인코딩을 하게 됩니다. %뒤에 2개의 16진수 코드를 입력하여 인코딩을 합니다.
space="%20"
ex) xxx.asp?usid=123&%20and%20select....



참고. 한글이 포함된 URL을 외부사이트로 보낼때 링크가 깨지는것을 막을때도 url인코딩을 사용합니다.

fireworking




FIREWALKING란?

필터링 장비의 룰(정책)을 조사할 때 사용하는 기법

Firewalk는 traceroute를 이용한 네트워크 스캔 도구이다 - IP 패킷 응답을 분석해서 게이트웨이 ACL(Access Control List) 필터를 점검하고, 그 정보로 네트워크 맴을 그려내는 기술이다. Firewalk Firewalking은 방화벽으로 둘러싸인 네트워크에 대한 정보를 수집하며 traceroute와 같은 IP 패킷 분석을 이용하여, 특정 패킷이 패킷 필터링 장치를 통과하여 공격자의 호스트에서 타겟 호스트로 전송될 수 있는가를 검사한다. 이러한 기술을 이용하여 게이트웨이의 열린 포트를 알아낼 수도 있으며, 또한 패킷 필터링 장치로 보호되는 내부의 라우터를 알아낼 수도 있다. 시스템 관리자는 자신의 네트워크 보안을 강화하는데 사용할 것이다.

네이버 설명 : 침입 차단 시스템이 보호하는 네트워크에 대한 정보를 수집하기 위한 도구의 일종. 트레이스라우트(traceroute)와 같은 유틸리티를 이용한 IP 응답 패킷을 분석하여 특정 패킷이 필터링 장치를 통과하여 공격자의 호스트에서 목표 호스트로 전송될 수 있는가를 검사한다. 이러한 기술을 이용하여 게이트웨이의 열린 포트나 패킷 필터링 장치로 보호되는 내부의 라우터를 알아내기도 하며, 자체 네트워크 보안을 강화하는 도구로도 사용한다.




하는방법 :


Access control lists represent an important first line of defense on most networks, since they are commonly used on routers to limit the protocols allowed to pass to host systems behind the router.Firewalk is an open source tool that will help you verify that your router ACLs are actually doing what you intended them to do. It can also be used as part of your security tool set for penetration testing and providing documented verification of ACLs, as well as rule sets on firewalls.

How it works
Firewalk attempts to determine which protocols a router or firewall will block and which they will pass on to downstream hosts. It operates on an IP expiry technique, much like the commonly used Traceroute program. The IP expiry technique involves manipulating the time to live (TTL) field of the IP header to map out all intermediate routers or hops between a scanning host and the target host. In Firewalk, scans are then sent with a TTL value one hop higher than that of the target host. If the scan packets are blocked by an ACL or firewall, they are dropped or rejected. If allowed to pass through, they will expire and elicit an ICMP time exceeded message. Based upon the results of the scans, Firewalk can identify which ports are open.

Installation
Firewalk is easily installed on any Linux/UNIX system (including Mac OS X). Firewalk relies on three back-end tools: libnet 1.1.x, lipcap, and libdnet. Start by downloading these tools, then unzip them with the "gunzip" command. Follow that with " ./configure", then "make" and finally "make install." After doing these command sequences for each of the backend tools, download Firewalk and do the same process for it.

Running Firewalk
Now that we're ready to run Firewalk, let's explore how it works. There are two phases of Firewalk. The first phase is basically a traceroute function called "hopcount ramping," and the second phase is the scanning or "firewalking" function. To see all the usage parameters, enter the "firewalk" command without supplying any of the host information. Here is what you will see.

Here's a brief explanation of the different options:



OptionDefaultExplanation
-d33434Allows you to specify a different destination port for the ramping phase
-ioffAllows you to specify a different interface
-noffPrevents DNS lookup—may increase speed
-pUDPAllows you to specify the scan protocol—can be TCP or UDP
-roffEnables strict RFC standards adherence
-S1-130, 139, 1025Allows you to specify a different port list for the scanning phase
-s53Allows you to specify a different source port for both phases
-T2Allows you to specify a different timeout for packet return
-toffAllows you to preload a TTL value to eliminate the ramping phase
-vN/AShows the version of Firewalk
-xoffAllows you to specify how many hops the binding host is from the target

To start firewalking, you must specify two hosts: the "target gateway," which is the router or firewall to be scanned, and the "metric." Normally we think of a metric as a number, but in this case, a metric is another gateway or host behind the target gateway.

Phase one—Hopcount ramping
Since the number of hops between the source host and the target host is not known, a standard Traceroute-style IP expiry scan is initiated. The TTL count is incremented at each hop until the target gateway is reached. At this point, the scan is "bound" to the current TTL plus one. Adding one more TTL allows the proceeding scans to go beyond the target gateway toward the metric host. The whole purpose of phase one is to find the TTL count for the target gateway.

Phase two—Firewalking
After reaching the target gateway and binding the scan to the proper TTL count, the actual scanning portion is started. Then either TCP or UDP packets are sent from the scanning host to the metric host one port at a time until the scan is completed. If a given probe is passed through the target gateway ACL, the scanning host receives an "ICMP TTL expired in transit" message from the binding host. If the scanning host receives no response after the timeout expires, it is assumed that the packet was denied by the ACL and was dropped.

Example scans
Figure A shows a diagram of the test network that we'll be using for two example scans.

Figure A


For our example, the target gateway is Router3 with the IP address of 192.168.100.2, and the metric is the host at IP address 192.168.200.10.

For demonstrative purposes, the first scan we'll do is without any ACL on the router. Then we'll apply an access list to the router, rerun our scan, and compare the firewalking results with our ACL. Note: Scan print outs have been shortened for brevity.

Scan 1—No ACL
We're going to run the following command:
[root@localhost local]# firewalk -s25� -d25 -pTCP 192.168.100.2 192.168.200.10

This will result in the following output:
Firewalk 5.0 [gateway ACL scanner]
Firewalk state initialization completed successfully.
TCP-based scan.
Ramping phase source port: 25, destination port: 25
Hotfoot through 192.168.100.2 using 192.168.200.10 as a metric.
Ramping Phase:
�1 (TTL� 1): expired [192.168.1.1]
�2 (TTL� 2): expired [192.168.1.10]
�3 (TTL� 3): expired [192.168.100.2]
Binding host reached.
Scan bound at 4 hops.
Scanning Phase:
port�� 1: A! open (port not listen) [192.168.200.10]
port�� 2: A! open (port not listen) [192.168.200.10]
port�� 3: A! open (port not listen) [192.168.200.10]
port� 21: A! open (port listen) [192.168.200.10]
port� 22: A! open (port not listen) [192.168.200.10]
port� 23: A! open (port not listen) [192.168.200.10]
port� 24: A! open (port not listen) [192.168.200.10]
port� 25: A! open (port listen) [192.168.200.10]
port� 26: A! open (port not listen) [192.168.200.10]
port 139: A! open (port not listen) [192.168.200.10]
port 1025: A! open (port not listen) [192.168.200.10]

Scan completed successfully.

Total packets sent:��������������� 135
Total packet errors:�������������� 0
Total packets caught�������������� 148
Total packets caught of interest�� 135
Total ports scanned��������������� 132
Total ports open:����������������� 132
Total ports unknown:�������������� 0

Firewalk displays "A!" when it determines that the metric host is directly behind the target gateway. From this scan we see that all ports are open, but the server is only listening to ports 21 and 25.

Scan 2—ACL applied
On the target router, I've added an ACL that blocks outbound traffic except for TCP ports 25 (SMTP) and 23 (Telnet) on the interface for network 192.168.200.0. Here's the router configuration:
interface Ethernet0
�ip address 192.168.200.1 255.255.255.0
�ip access-group 101 out
�no ip directed-broadcast
access-list 101 permit icmp any any
access-list 101 permit tcp any any eq smtp
access-list 101 permit tcp any any eq telnet
access-list 101 deny any any

Here's what Firewalk reports when we run a scan:
[root@localhost root]# firewalk -pTCP 192.168.100.2 192.168.200.10
Firewalk 5.0 [gateway ACL scanner]
Firewalk state initialization completed successfully.
TCP-based scan.
Ramping phase source port: 53, destination port: 33434
Hotfoot through 192.168.100.2 using 192.168.200.10 as a metric.
Ramping Phase:
�1 (TTL� 1): expired [192.168.1.1]
�2 (TTL� 2): expired [192.168.1.10]
�3 (TTL� 3): expired [192.168.100.2]
Binding host reached.
Scan bound at 4 hops.
Scanning Phase:
port� 21: unknown (unreach ICMP_UNREACH_FILTER_PROHIB) [192.168.100.2]
port� 22: *no response*
port� 23: A! open (port listen) [192.168.200.10]
port� 24: unknown (unreach ICMP_UNREACH_FILTER_PROHIB) [192.168.100.2]
port� 25: A! open (port listen) [192.168.200.10]
port� 26: *no response*
port� 27: unknown (unreach ICMP_UNREACH_FILTER_PROHIB) [192.168.100.2]
port 139: unknown (unreach ICMP_UNREACH_FILTER_PROHIB) [192.168.100.2]
port 1025: *no response*

Scan completed successfully.

Total packets sent:��������������� 135
Total packet errors:��������������0
Total packets caught�������������� 73
Total packets caught of interest�� 72
Total ports scanned��������������� 132
Total ports open:����������������� 2
Total ports unknown:�������������� 67


The two ports definitely open are 23 (Telnet) and 25 (SMTP). The ports reporting "no response" are basically invisible. This means that no response was received before timing out. We can assume that the packets were dropped, but as you can tell from this example, you need to run a variety of scans to really map an access list or firewall rule set.

Summary
This article provides an introductory look at the capabilities of Firewalk. This open source tool clearly warrants further study and usage, and undoubtedly has a viable place in the network security tool chest for auditing and documentation purposes. One thing to keep in mind is that this is a "noisy" application, meaning it's activity will be picked up by router and firewall logs as well as by any listening IDS, so be sure you have approval before scanning any routers or firewalls.

Backtrack with chrome



구글 크롬 설치

deb 패키지.
dpkg -i google-chrome-st......deb
그리고 실행파일을 밖으로 옮긴후
다음과 같이 설정한다.


방식1번
command에다가 다음과 같이 입력한다.
/opt/google/chrome/google-chrome --user-data-dir=/root/\.chrome %U
완성이다.









방식2번.



[linux-box]# whereis google-chrome
--------------------------------------------------
>> it's a script that runs the real google-chrome binary
Go to the line that excutes real binary and put "--user-data-dir" at the end,
It was:
exec -a "$0" "$HERE/chrome" "$@"
and I changed it to:
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir








apt를 이용한 방식
Many people are questioning how to install google chrome in backtrack.
This time I will tell you how to install google chrome in backtrack 5. Follow the steps below :
1. apt-get install chromium-browser
You can also use synaptic and select the chromium-browser.
2. cd /usr/lib/chromium-browser
3. Replace geteuid to be getppid using hexedit with the following command :
hexedit chromium-browser
Then press tab to switch to the mode string. Then press ctrl+s and type geteuid. Replace geteuid to be getppid then press ctrl+x to exit!
4. Enjoy your google chrome!!!


이거나


이걸로 설치 한다. 나는 이미 설치해서 설치 되지 않는다.

Backtrack 5 korean input.


for Backtrack


간략화 버젼
apt-get install language-selector
그러면 system administrator 부분에
몇개가 설치된다.
Language-support를 클릭하여
한국어를 설치한다.

#aptitude install ibus-hangul
ibus설치한다.

ibus를 설치한 후 한글 설정을 한다.
aptitude install scim-qtimm im-switch scim-hangul ibus-hangul

startup 등록.

/usr/bin/ibus-daemon

추가.
# vi $HOME/.bashrc


export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus


Wardriving?



WarXing

From Wikipedia, the free encyclopedia

WarXing (Pronounced "Work-sing"), NetStumbling or WILDing [1] is the activity of detecting publicly accessible computer systems or (wireless) networks. The 'X' may be replaced by a more specific activity to give the following terms:

Warcarting — Wardriving, but instead of a car, a shopping cart [2]
쇼핑카트??를 이용한 워 드라이빙의 일종인듯.

Warchalking — the name for marking the location of a Wi-Fi wireless network with a chalk mark on the sidewalk.

메트존스(Matt Jones)라는 웹디자이너가 제안한 것으로
무선인터넷이 가능한 지역을 표시, 누구나 무선으로 인터넷을 사용할 수 있도록 하자는 것.


Warcycling — detecting Wi-Fi wireless networks by cycling around with a Wi-Fi equipped device on a bicycle
와이파이 탐지 장비를 자전거에 부착하고 라이딩을 하며 네트워크 정보 수집

War dialing — detecting computer systems linked to the telephone network by dialing every number in an area code
지역의 모든 전화로 무작위로 걸어서 모뎀(컴퓨터 시스템)이나 팩스를검색하는 방식

Wardriving — detecting Wi-Fi wireless networks by driving around with a Wi-Fi-equipped device, such as a laptop or a PDA, in one's vehicle.
차량에 랩탑 또는 PDA를 장착하고 와이파이 정보를 수집하는 기법

Warflying — using an aircraft and a Wi-Fi-equipped device, such as a laptop or a PDA, to detect Wi-Fi wireless networks.
비행기를 이용하여...ㅡ_ㅡ 와이파이 정보를 수집하는 기법..별걸 다 이용한다.

Warrunning; detecting Wi-Fi wireless networks by running with a Wi-Fi equipped device.
달리면서 와이파이 정보를 수집하는...

Warspying — detecting and viewing wireless video. Usually done by driving around with an x10 receiver. Similar to "Wardriving" only with wireless video instead of wireless networks.
무선 비디오를 감지하여 보는방법 워 드라이빙과 비슷한 방법이라고 한다. 무선으로 날라다니는 영상을 캡춰 하는방식인듯 하다.

Wartoothing — The same concept as warwalking, except using bluetooth devices.
블루투스 정보를 모으는 기법이다. 걸어다니며 이루어 진다.

Wartransit — same as wardriving, except done aboard a local transit bus, subway, or commuter train.
대중교통을 이용한 정보 수집기법이다.

Wartrawling — detecting Wi-Fi wireless networks at sea with a Wi-Fi-equipped device in the vicinity of vessels receiving via satellite and broadcasting Wi-Fi for their onboard network. Coined by FTC/SS Donald A. Davis, USN, upon implementation of the first Wi-Fi networks on US Submarines.
바다에서 정보를 수집하는 방식이다.

Warwalking — searching for Wi-Fi wireless networks by a person walking, using a Wi-Fi-equipped device, such as a laptop or a PDA.
걸어다니면서 정보를 수집한다. 랩탑과 PDA와 같은 기기를 이용하여.

These terms originated from wardialing, a technique popularized by a character played by Matthew Broderick in the film WarGames, and named after that film. Wardialing in this context refers to the practice of using a computer to dial many phone numbers in the hopes of finding an active modem.
While it doesn't conform to the "WarXing" pattern, bluedriving (wardriving against Bluetooth networks) has also been seen as a related word.