Restrict SSRF Regexes
This commit is contained in:
		
				
					committed by
					
						 Àngel Ollé Blázquez
						Àngel Ollé Blázquez
					
				
			
			
				
	
			
			
			
						parent
						
							0795ff0fc5
						
					
				
				
					commit
					cbf2e153d9
				
			| @ -44,12 +44,12 @@ public class SSRFTask1 extends AssignmentEndpoint { | |||||||
|     try { |     try { | ||||||
|       StringBuilder html = new StringBuilder(); |       StringBuilder html = new StringBuilder(); | ||||||
|  |  | ||||||
|       if (url.matches("images/tom.png")) { |       if (url.matches("images/tom\\.png")) { | ||||||
|         html.append( |         html.append( | ||||||
|             "<img class=\"image\" alt=\"Tom\" src=\"images/tom.png\" width=\"25%\"" |             "<img class=\"image\" alt=\"Tom\" src=\"images/tom.png\" width=\"25%\"" | ||||||
|                 + " height=\"25%\">"); |                 + " height=\"25%\">"); | ||||||
|         return failed(this).feedback("ssrf.tom").output(html.toString()).build(); |         return failed(this).feedback("ssrf.tom").output(html.toString()).build(); | ||||||
|       } else if (url.matches("images/jerry.png")) { |       } else if (url.matches("images/jerry\\.png")) { | ||||||
|         html.append( |         html.append( | ||||||
|             "<img class=\"image\" alt=\"Jerry\" src=\"images/jerry.png\" width=\"25%\"" |             "<img class=\"image\" alt=\"Jerry\" src=\"images/jerry.png\" width=\"25%\"" | ||||||
|                 + " height=\"25%\">"); |                 + " height=\"25%\">"); | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ public class SSRFTask2 extends AssignmentEndpoint { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   protected AttackResult furBall(String url) { |   protected AttackResult furBall(String url) { | ||||||
|     if (url.matches("http://ifconfig.pro")) { |     if (url.matches("http://ifconfig\\.pro")) { | ||||||
|       String html; |       String html; | ||||||
|       try (InputStream in = new URL(url).openStream()) { |       try (InputStream in = new URL(url).openStream()) { | ||||||
|         html = |         html = | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user