SlideShare a Scribd company logo
Reversing warsaw's Java Crackme 1.1
	
  
	
  
Introduction	
  
	
  
	
               Well,	
  to	
  be	
  frank,	
  this	
  was	
  fun.	
  I	
  downloaded	
  the	
  crackme	
  just	
  for	
  the	
  heck	
  of	
  
it	
  &	
  to	
  my	
  surprise,	
  none	
  of	
  the	
  existing	
  regular	
  java	
  decompilers	
  worked.	
  	
  So	
  I	
  
thought,	
  what	
  the	
  hell!	
  Lets	
  give	
  it	
  a	
  try.	
  	
  Now,	
  the	
  first	
  thing	
  I	
  did	
  was	
  to	
  open	
  it	
  in	
  
my	
  favourite	
  java	
  decompiler	
  jd-­‐gui.	
  As	
  expected,	
  jd-­‐gui	
  couldn’t	
  really	
  handle	
  the	
  
crackme.	
  Let	
  me	
  attach	
  a	
  screenshot	
  for	
  you.	
  	
  
	
  
Nah,	
  its	
  not	
  a	
  complete	
  fail.	
  It	
  does	
  show	
  some	
  interesting	
  stuff	
  but	
  I	
  felt	
  it	
  was	
  
unreliable.	
  So,	
  what	
  do	
  you	
  do	
  next?	
  For	
  me,	
  the	
  next	
  obvious	
  step	
  was	
  to	
  put	
  it	
  
through	
  some	
  heavy	
  duty	
  tools.	
  IDA	
  Pro	
  kinda	
  stands	
  out	
  when	
  you	
  think	
  of	
  heavy	
  
duty	
  reversing	
  tools	
  &	
  its	
  not	
  for	
  no	
  reason.	
  It	
  does	
  a	
  pretty	
  good	
  job	
  at	
  that.	
  J	
  So,	
  I	
  
just	
  extracted	
  the	
  Code.class	
  file	
  from	
  the	
  crackme1.1.jar.	
  Whats	
  left	
  was	
  importing	
  
it	
  into	
  IDA	
  &	
  analyzing	
  it.	
  Let	
  me	
  attach	
  another	
  screenshot	
  for	
  you	
  to	
  see	
  how	
  it	
  
looked.	
  
	
  




	
  
The	
  first	
  thing	
  that	
  you	
  see	
  is	
  IDA	
  complaining	
  that	
  something	
  was	
  not	
  right	
  when	
  it	
  
tried	
  to	
  disassemble	
  the	
  class	
  file.	
  No	
  surprise	
  there	
  ;)	
  Lets	
  look	
  further	
  &	
  see	
  whats	
  
there.	
  
And	
  the	
  whining	
  continues.	
  There	
  is	
  that	
  line	
  of	
  code	
  right	
  at	
  start	
  that’s	
  flagged	
  red	
  
by	
  IDA.	
  Before	
  we	
  start	
  burning	
  precious	
  grey	
  cells,	
  lets	
  analyze	
  further	
  the	
  IDA’s	
  
output.	
  
	
  
	
  




	
  
	
  
	
  
That’s	
  a	
  lot	
  of	
  junk	
  in	
  there.	
  And	
  quite	
  possibly	
  the	
  reason	
  why	
  jd-­‐gui	
  failed	
  to	
  
handle	
  it.	
  If	
  am	
  not	
  wrong,	
  its	
  called	
  as	
  ‘junk-­‐byte-­‐injection’	
  in	
  today’s	
  parlance.	
  And	
  
its	
  funny	
  how	
  most	
  of	
  the	
  existing	
  tools	
  fail	
  at	
  handling	
  something	
  as	
  simple	
  as	
  this.	
  
So,	
  the	
  next	
  big	
  question	
  is..	
  what	
  now?	
  I	
  kinda	
  like	
  to	
  be	
  sure	
  that	
  am	
  on	
  the	
  right	
  
track	
  before	
  I	
  proceed	
  further.	
  So,	
  just	
  for	
  the	
  heck	
  of	
  it,	
  lets	
  try	
  to	
  fix	
  the	
  class	
  file.	
  
To	
  do	
  that,	
  first	
  of	
  all	
  lets	
  see	
  what	
  the	
  opcodes	
  are	
  for	
  this	
  “getstatic	
  37”	
  instruction.	
  
	
  
	
  	
  




	
  	
  
As	
  it	
  turns	
  out,	
  its	
  “B2	
  00	
  25”.	
  Hmm.	
  Another	
  important	
  thing	
  to	
  note	
  here	
  is	
  that	
  
this	
  is	
  the	
  only	
  junk	
  instruction	
  in	
  whole	
  of	
  the	
  disassembly	
  produced	
  by	
  IDA.	
  	
  So	
  if	
  
we	
  simply	
  replaced	
  this	
  instruction	
  with	
  the	
  equivalent	
  java	
  bytecode’s	
  NOP	
  opcode,	
  	
  
theoretically	
  the	
  class	
  file	
  should	
  be	
  somewhat	
  fixed.	
  All	
  I	
  did	
  was	
  fire-­‐up	
  my	
  
favourite	
  hex-­‐editor	
  &	
  use	
  its	
  crazy	
  ‘Replace	
  All’	
  option.	
  That	
  calls	
  for	
  another	
  
screenshot	
  ;)	
  
	
  




	
  
Well,	
  yea…	
  that	
  was	
  quick.	
  NOP	
  in	
  Java’s	
  Bytecode	
  is	
  0x00.	
  That’s	
  why	
  I	
  simply	
  
replaced	
  those	
  3	
  bytes	
  with	
  0x00.	
  It	
  replaced	
  the	
  whole	
  junk	
  in	
  a	
  jiffy	
  .	
  Now	
  its	
  time	
  
to	
  see	
  if	
  what	
  we	
  hoped	
  for	
  really	
  worked	
  or	
  we	
  just	
  killed	
  the	
  class	
  file	
  :D	
  .	
  Lets	
  try	
  
opening	
  it	
  in	
  jd-­‐gui	
  &	
  see	
  what	
  happens.	
  
	
  
	
  
 
	
  
Hey!	
  That’s	
  way	
  better!	
  So	
  far,	
  it	
  took	
  us	
  just	
  20	
  minutes	
  or	
  so	
  and	
  we	
  already	
  have	
  
the	
  code	
  although	
  somewhat	
  broken.	
  But	
  this	
  is	
  good.	
  Am	
  sure	
  the	
  core	
  logic	
  of	
  it	
  is	
  
perfect.	
  Now,	
  if	
  we	
  look	
  at	
  the	
  code,	
  it	
  simply	
  takes	
  the	
  argument	
  we	
  pass,	
  multiplies	
  
it	
  with	
  (-­‐37),	
  adds	
  42	
  to	
  it	
  &	
  then	
  compares	
  it	
  with	
  the	
  magic	
  value	
  of	
  “1720653869”	
  
But!	
  Theres	
  a	
  catch.	
  J	
  It	
  converts	
  your	
  input	
  to	
  Integer	
  before	
  it	
  multiplies	
  it	
  with	
  	
  	
  
(-­‐37).	
  You’ll	
  say,	
  so	
  what?	
  Well,	
  brotha	
  its	
  not	
  that	
  easy	
  of	
  an	
  equation.	
  If	
  you	
  simply	
  
look	
  at	
  it	
  from	
  mathematics	
  point	
  of	
  view,	
  the	
  equation	
  turns	
  out	
  to	
  be	
  :	
  
	
  
                                               Value	
  *	
  (-­‐37)	
  +	
  42	
  =	
  1720653869	
  
                                         So,	
  	
  Value	
  =	
  -­‐(1720653869-­‐42)/(37).	
  
                                          Hence,	
  Value	
  =	
  -­‐46504157.4864865	
  
                                                                              	
  
So	
  common-­‐sense	
  dictates	
  that	
  if	
  we	
  pass	
  -­‐46504157.4864865	
  as	
  the	
  value,	
  we	
  
should	
  get	
  the	
  sweet	
  “Correct”	
  message	
  &	
  be	
  done.	
  But	
  nopes,	
  the	
  code	
  wont	
  take	
  a	
  
floating	
  point	
  value.	
  Even	
  if	
  you	
  somehow	
  by	
  your	
  ninja-­‐skillz	
  do	
  manage	
  to	
  pass	
  it,	
  
it’ll	
  convert	
  it	
  to	
  type	
  Integer.	
  	
  Ah	
  well!	
  How	
  can	
  I	
  possibly	
  know	
  that	
  for	
  sure?	
  :D	
  I	
  
hav’nt	
  tried	
  running	
  the	
  app	
  yet.	
  Dumb.	
  Lets	
  check	
  it	
  out.	
  
	
  
So	
  that	
  proves	
  it	
  beyond	
  doubt	
  that	
  I	
  was	
  right.	
  	
  Some	
  of	
  the	
  things	
  we	
  can	
  deduce	
  
from	
  my	
  futile	
  attempts	
  at	
  trying	
  out	
  the	
  crackme	
  are	
  :	
  
	
  
       • It	
  won’t	
  take	
  numbers	
  with	
  a	
  decimal	
  in	
  it.	
  (Float	
  values)	
  
       • The	
  code	
  we	
  calculated	
  fails	
  miserably	
  even	
  if	
  we	
  try	
  to	
  round	
  it	
  off	
  to	
  the	
  
              nearest	
  integers.	
  
	
  
This	
  is	
  bad.	
  But	
  we	
  are	
  the	
  Ninja-­‐Reversers	
  aren’t	
  we?	
  So	
  well,	
  either	
  we	
  can	
  find	
  out	
  
why	
  this	
  happens	
  by	
  googling	
  things	
  related	
  to	
  “use	
  of	
  prime	
  numbers	
  in	
  calculating	
  
hash	
  values”,”Integer	
  overflows”	
  &	
  lots	
  more	
  or	
  simply	
  do	
  it	
  the	
  easy-­‐peasy	
  way.	
  
Lets	
  write	
  another	
  java	
  code	
  that	
  reverses	
  the	
  algo	
  &	
  since	
  its	
  pretty	
  simple,	
  
bruteforces	
  it	
  to	
  get	
  us	
  the	
  right	
  value.	
  What	
  say?	
  Let	
  me	
  show	
  you	
  the	
  code	
  I	
  made.	
  
	
  




	
  
	
  
Guess	
  what?	
  It	
  works!	
  J	
  Apparently	
  “-­‐975145735”	
  is	
  supposed	
  to	
  be	
  the	
  right	
  
value.	
  Lets	
  give	
  it	
  a	
  try	
  in	
  the	
  actual	
  crackme.	
  Shall	
  we?	
  ;)	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
And	
  that’s	
  how	
  its	
  done,	
  dutch.	
  I	
  hope	
  you	
  learnt	
  something	
  new	
  out	
  of	
  this	
  tutorial.	
  
I	
  sure	
  did	
  enjoy	
  reversing	
  this	
  one.	
  	
  Have	
  a	
  wonderful	
  day	
  ahead!	
  
	
  
                                                                   ©	
  Aodrulez	
  
                                                   (	
  atul.alex@orchidseven.com	
  )	
  

More Related Content

Viewers also liked

My solution to malware.lu HackGyver's challenges.
My solution to malware.lu HackGyver's challenges.My solution to malware.lu HackGyver's challenges.
My solution to malware.lu HackGyver's challenges.
Aodrulez
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
In a Rocket
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
Kirsty Hulse
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
ux singapore
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Stanford GSB Corporate Governance Research Initiative
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
Barry Feldman
 

Viewers also liked (6)

My solution to malware.lu HackGyver's challenges.
My solution to malware.lu HackGyver's challenges.My solution to malware.lu HackGyver's challenges.
My solution to malware.lu HackGyver's challenges.
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
 

Similar to Solution to warsaw's crackme1.1

Checking VirtualDub
Checking VirtualDubChecking VirtualDub
Checking VirtualDub
Andrey Karpov
 
Checking PVS-Studio with Clang
Checking PVS-Studio with ClangChecking PVS-Studio with Clang
Checking PVS-Studio with Clang
Andrey Karpov
 
TDD Walkthrough - Encryption
TDD Walkthrough - EncryptionTDD Walkthrough - Encryption
TDD Walkthrough - Encryption
PeterKha2
 
Managing JavaScript Complexity
Managing JavaScript ComplexityManaging JavaScript Complexity
Managing JavaScript Complexity
Jarrod Overson
 
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-StudioArcheology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Andrey Karpov
 
Of complicacy of programming, or won't C# save us?
Of complicacy of programming, or won't C# save us?Of complicacy of programming, or won't C# save us?
Of complicacy of programming, or won't C# save us?
PVS-Studio
 
Testing and validating distributed systems with Apache Spark and Apache Beam ...
Testing and validating distributed systems with Apache Spark and Apache Beam ...Testing and validating distributed systems with Apache Spark and Apache Beam ...
Testing and validating distributed systems with Apache Spark and Apache Beam ...
Holden Karau
 
Zero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for youZero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for you
Andrey Karpov
 
Beyond Testing: Specs and Behavior Driven Development
Beyond Testing: Specs and Behavior  Driven DevelopmentBeyond Testing: Specs and Behavior  Driven Development
Beyond Testing: Specs and Behavior Driven Development
Rabble .
 
Why Students Need the CppCat Code Analyzer
Why Students Need the CppCat Code AnalyzerWhy Students Need the CppCat Code Analyzer
Why Students Need the CppCat Code Analyzer
PVS-Studio
 
Clean code and code smells
Clean code and code smellsClean code and code smells
Clean code and code smells
Md. Aftab Uddin Kajal
 
writing self-modifying code and utilizing advanced assembly techniques
writing self-modifying code and utilizing advanced assembly techniqueswriting self-modifying code and utilizing advanced assembly techniques
writing self-modifying code and utilizing advanced assembly techniques
Russell Sanford
 
Playfulness at Work
Playfulness at WorkPlayfulness at Work
Playfulness at Work
Erin Dees
 
Qtp Descriptive Programming 11200
Qtp Descriptive Programming 11200Qtp Descriptive Programming 11200
Qtp Descriptive Programming 11200techgajanan
 
QTP Descriptive Programming
QTP Descriptive ProgrammingQTP Descriptive Programming
QTP Descriptive Programming
Yaron Assa
 
Qtp Descriptive Programming 11200
Qtp Descriptive Programming 11200Qtp Descriptive Programming 11200
Qtp Descriptive Programming 11200
Siddhartha Parida
 
CppCat Static Analyzer Review
CppCat Static Analyzer ReviewCppCat Static Analyzer Review
CppCat Static Analyzer Review
Andrey Karpov
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
Andrey Karpov
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
PVS-Studio
 

Similar to Solution to warsaw's crackme1.1 (20)

Checking VirtualDub
Checking VirtualDubChecking VirtualDub
Checking VirtualDub
 
Lightning talk- testing
Lightning talk- testingLightning talk- testing
Lightning talk- testing
 
Checking PVS-Studio with Clang
Checking PVS-Studio with ClangChecking PVS-Studio with Clang
Checking PVS-Studio with Clang
 
TDD Walkthrough - Encryption
TDD Walkthrough - EncryptionTDD Walkthrough - Encryption
TDD Walkthrough - Encryption
 
Managing JavaScript Complexity
Managing JavaScript ComplexityManaging JavaScript Complexity
Managing JavaScript Complexity
 
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-StudioArcheology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
 
Of complicacy of programming, or won't C# save us?
Of complicacy of programming, or won't C# save us?Of complicacy of programming, or won't C# save us?
Of complicacy of programming, or won't C# save us?
 
Testing and validating distributed systems with Apache Spark and Apache Beam ...
Testing and validating distributed systems with Apache Spark and Apache Beam ...Testing and validating distributed systems with Apache Spark and Apache Beam ...
Testing and validating distributed systems with Apache Spark and Apache Beam ...
 
Zero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for youZero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for you
 
Beyond Testing: Specs and Behavior Driven Development
Beyond Testing: Specs and Behavior  Driven DevelopmentBeyond Testing: Specs and Behavior  Driven Development
Beyond Testing: Specs and Behavior Driven Development
 
Why Students Need the CppCat Code Analyzer
Why Students Need the CppCat Code AnalyzerWhy Students Need the CppCat Code Analyzer
Why Students Need the CppCat Code Analyzer
 
Clean code and code smells
Clean code and code smellsClean code and code smells
Clean code and code smells
 
writing self-modifying code and utilizing advanced assembly techniques
writing self-modifying code and utilizing advanced assembly techniqueswriting self-modifying code and utilizing advanced assembly techniques
writing self-modifying code and utilizing advanced assembly techniques
 
Playfulness at Work
Playfulness at WorkPlayfulness at Work
Playfulness at Work
 
Qtp Descriptive Programming 11200
Qtp Descriptive Programming 11200Qtp Descriptive Programming 11200
Qtp Descriptive Programming 11200
 
QTP Descriptive Programming
QTP Descriptive ProgrammingQTP Descriptive Programming
QTP Descriptive Programming
 
Qtp Descriptive Programming 11200
Qtp Descriptive Programming 11200Qtp Descriptive Programming 11200
Qtp Descriptive Programming 11200
 
CppCat Static Analyzer Review
CppCat Static Analyzer ReviewCppCat Static Analyzer Review
CppCat Static Analyzer Review
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
 

Recently uploaded

高仿(nyu毕业证书)美国纽约大学毕业证文凭毕业证原版一模一样
高仿(nyu毕业证书)美国纽约大学毕业证文凭毕业证原版一模一样高仿(nyu毕业证书)美国纽约大学毕业证文凭毕业证原版一模一样
高仿(nyu毕业证书)美国纽约大学毕业证文凭毕业证原版一模一样
9u08k0x
 
Tom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive AnalysisTom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive Analysis
greendigital
 
Emcee Profile_ Subbu from Bangalore .pdf
Emcee Profile_ Subbu from Bangalore .pdfEmcee Profile_ Subbu from Bangalore .pdf
Emcee Profile_ Subbu from Bangalore .pdf
subran
 
Skeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on ForumSkeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on Forum
Isaac More
 
Matt Rife Cancels Shows Due to Health Concerns, Reschedules Tour Dates.pdf
Matt Rife Cancels Shows Due to Health Concerns, Reschedules Tour Dates.pdfMatt Rife Cancels Shows Due to Health Concerns, Reschedules Tour Dates.pdf
Matt Rife Cancels Shows Due to Health Concerns, Reschedules Tour Dates.pdf
Azura Everhart
 
_7 OTT App Builders to Support the Development of Your Video Applications_.pdf
_7 OTT App Builders to Support the Development of Your Video Applications_.pdf_7 OTT App Builders to Support the Development of Your Video Applications_.pdf
_7 OTT App Builders to Support the Development of Your Video Applications_.pdf
Mega P
 
哪里买(osu毕业证书)美国俄勒冈州立大学毕业证双学位证书原版一模一样
哪里买(osu毕业证书)美国俄勒冈州立大学毕业证双学位证书原版一模一样哪里买(osu毕业证书)美国俄勒冈州立大学毕业证双学位证书原版一模一样
哪里买(osu毕业证书)美国俄勒冈州立大学毕业证双学位证书原版一模一样
9u08k0x
 
Scandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.zaScandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.za
Isaac More
 
This Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I MadeThis Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I Made
Aarush Ghate
 
240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf
Madhura TBRC
 
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and LoveMeet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
get joys
 
Modern Radio Frequency Access Control Systems: The Key to Efficiency and Safety
Modern Radio Frequency Access Control Systems: The Key to Efficiency and SafetyModern Radio Frequency Access Control Systems: The Key to Efficiency and Safety
Modern Radio Frequency Access Control Systems: The Key to Efficiency and Safety
AITIX LLC
 
Snoopy boards the big bow wow musical __
Snoopy boards the big bow wow musical __Snoopy boards the big bow wow musical __
Snoopy boards the big bow wow musical __
catcabrera
 
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to StardomYoung Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
greendigital
 
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles onlineTreasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Hidden Treasure Hunts
 
Hollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest galleryHollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest gallery
Zsolt Nemeth
 
DIGIDEVTV A New area of OTT Distribution
DIGIDEVTV  A New area of OTT DistributionDIGIDEVTV  A New area of OTT Distribution
DIGIDEVTV A New area of OTT Distribution
joeqsm
 
I Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledgeI Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledge
Sabrina Ricci
 
A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024
Indira Srivatsa
 
Christina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptxChristina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptx
madeline604788
 

Recently uploaded (20)

高仿(nyu毕业证书)美国纽约大学毕业证文凭毕业证原版一模一样
高仿(nyu毕业证书)美国纽约大学毕业证文凭毕业证原版一模一样高仿(nyu毕业证书)美国纽约大学毕业证文凭毕业证原版一模一样
高仿(nyu毕业证书)美国纽约大学毕业证文凭毕业证原版一模一样
 
Tom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive AnalysisTom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive Analysis
 
Emcee Profile_ Subbu from Bangalore .pdf
Emcee Profile_ Subbu from Bangalore .pdfEmcee Profile_ Subbu from Bangalore .pdf
Emcee Profile_ Subbu from Bangalore .pdf
 
Skeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on ForumSkeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on Forum
 
Matt Rife Cancels Shows Due to Health Concerns, Reschedules Tour Dates.pdf
Matt Rife Cancels Shows Due to Health Concerns, Reschedules Tour Dates.pdfMatt Rife Cancels Shows Due to Health Concerns, Reschedules Tour Dates.pdf
Matt Rife Cancels Shows Due to Health Concerns, Reschedules Tour Dates.pdf
 
_7 OTT App Builders to Support the Development of Your Video Applications_.pdf
_7 OTT App Builders to Support the Development of Your Video Applications_.pdf_7 OTT App Builders to Support the Development of Your Video Applications_.pdf
_7 OTT App Builders to Support the Development of Your Video Applications_.pdf
 
哪里买(osu毕业证书)美国俄勒冈州立大学毕业证双学位证书原版一模一样
哪里买(osu毕业证书)美国俄勒冈州立大学毕业证双学位证书原版一模一样哪里买(osu毕业证书)美国俄勒冈州立大学毕业证双学位证书原版一模一样
哪里买(osu毕业证书)美国俄勒冈州立大学毕业证双学位证书原版一模一样
 
Scandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.zaScandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.za
 
This Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I MadeThis Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I Made
 
240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf
 
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and LoveMeet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
 
Modern Radio Frequency Access Control Systems: The Key to Efficiency and Safety
Modern Radio Frequency Access Control Systems: The Key to Efficiency and SafetyModern Radio Frequency Access Control Systems: The Key to Efficiency and Safety
Modern Radio Frequency Access Control Systems: The Key to Efficiency and Safety
 
Snoopy boards the big bow wow musical __
Snoopy boards the big bow wow musical __Snoopy boards the big bow wow musical __
Snoopy boards the big bow wow musical __
 
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to StardomYoung Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
 
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles onlineTreasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
 
Hollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest galleryHollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest gallery
 
DIGIDEVTV A New area of OTT Distribution
DIGIDEVTV  A New area of OTT DistributionDIGIDEVTV  A New area of OTT Distribution
DIGIDEVTV A New area of OTT Distribution
 
I Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledgeI Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledge
 
A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024
 
Christina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptxChristina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptx
 

Solution to warsaw's crackme1.1

  • 1. Reversing warsaw's Java Crackme 1.1     Introduction       Well,  to  be  frank,  this  was  fun.  I  downloaded  the  crackme  just  for  the  heck  of   it  &  to  my  surprise,  none  of  the  existing  regular  java  decompilers  worked.    So  I   thought,  what  the  hell!  Lets  give  it  a  try.    Now,  the  first  thing  I  did  was  to  open  it  in   my  favourite  java  decompiler  jd-­‐gui.  As  expected,  jd-­‐gui  couldn’t  really  handle  the   crackme.  Let  me  attach  a  screenshot  for  you.      
  • 2. Nah,  its  not  a  complete  fail.  It  does  show  some  interesting  stuff  but  I  felt  it  was   unreliable.  So,  what  do  you  do  next?  For  me,  the  next  obvious  step  was  to  put  it   through  some  heavy  duty  tools.  IDA  Pro  kinda  stands  out  when  you  think  of  heavy   duty  reversing  tools  &  its  not  for  no  reason.  It  does  a  pretty  good  job  at  that.  J  So,  I   just  extracted  the  Code.class  file  from  the  crackme1.1.jar.  Whats  left  was  importing   it  into  IDA  &  analyzing  it.  Let  me  attach  another  screenshot  for  you  to  see  how  it   looked.       The  first  thing  that  you  see  is  IDA  complaining  that  something  was  not  right  when  it   tried  to  disassemble  the  class  file.  No  surprise  there  ;)  Lets  look  further  &  see  whats   there.  
  • 3. And  the  whining  continues.  There  is  that  line  of  code  right  at  start  that’s  flagged  red   by  IDA.  Before  we  start  burning  precious  grey  cells,  lets  analyze  further  the  IDA’s   output.             That’s  a  lot  of  junk  in  there.  And  quite  possibly  the  reason  why  jd-­‐gui  failed  to   handle  it.  If  am  not  wrong,  its  called  as  ‘junk-­‐byte-­‐injection’  in  today’s  parlance.  And   its  funny  how  most  of  the  existing  tools  fail  at  handling  something  as  simple  as  this.   So,  the  next  big  question  is..  what  now?  I  kinda  like  to  be  sure  that  am  on  the  right   track  before  I  proceed  further.  So,  just  for  the  heck  of  it,  lets  try  to  fix  the  class  file.   To  do  that,  first  of  all  lets  see  what  the  opcodes  are  for  this  “getstatic  37”  instruction.            
  • 4. As  it  turns  out,  its  “B2  00  25”.  Hmm.  Another  important  thing  to  note  here  is  that   this  is  the  only  junk  instruction  in  whole  of  the  disassembly  produced  by  IDA.    So  if   we  simply  replaced  this  instruction  with  the  equivalent  java  bytecode’s  NOP  opcode,     theoretically  the  class  file  should  be  somewhat  fixed.  All  I  did  was  fire-­‐up  my   favourite  hex-­‐editor  &  use  its  crazy  ‘Replace  All’  option.  That  calls  for  another   screenshot  ;)       Well,  yea…  that  was  quick.  NOP  in  Java’s  Bytecode  is  0x00.  That’s  why  I  simply   replaced  those  3  bytes  with  0x00.  It  replaced  the  whole  junk  in  a  jiffy  .  Now  its  time   to  see  if  what  we  hoped  for  really  worked  or  we  just  killed  the  class  file  :D  .  Lets  try   opening  it  in  jd-­‐gui  &  see  what  happens.      
  • 5.     Hey!  That’s  way  better!  So  far,  it  took  us  just  20  minutes  or  so  and  we  already  have   the  code  although  somewhat  broken.  But  this  is  good.  Am  sure  the  core  logic  of  it  is   perfect.  Now,  if  we  look  at  the  code,  it  simply  takes  the  argument  we  pass,  multiplies   it  with  (-­‐37),  adds  42  to  it  &  then  compares  it  with  the  magic  value  of  “1720653869”   But!  Theres  a  catch.  J  It  converts  your  input  to  Integer  before  it  multiplies  it  with       (-­‐37).  You’ll  say,  so  what?  Well,  brotha  its  not  that  easy  of  an  equation.  If  you  simply   look  at  it  from  mathematics  point  of  view,  the  equation  turns  out  to  be  :     Value  *  (-­‐37)  +  42  =  1720653869   So,    Value  =  -­‐(1720653869-­‐42)/(37).   Hence,  Value  =  -­‐46504157.4864865     So  common-­‐sense  dictates  that  if  we  pass  -­‐46504157.4864865  as  the  value,  we   should  get  the  sweet  “Correct”  message  &  be  done.  But  nopes,  the  code  wont  take  a   floating  point  value.  Even  if  you  somehow  by  your  ninja-­‐skillz  do  manage  to  pass  it,   it’ll  convert  it  to  type  Integer.    Ah  well!  How  can  I  possibly  know  that  for  sure?  :D  I   hav’nt  tried  running  the  app  yet.  Dumb.  Lets  check  it  out.    
  • 6. So  that  proves  it  beyond  doubt  that  I  was  right.    Some  of  the  things  we  can  deduce   from  my  futile  attempts  at  trying  out  the  crackme  are  :     • It  won’t  take  numbers  with  a  decimal  in  it.  (Float  values)   • The  code  we  calculated  fails  miserably  even  if  we  try  to  round  it  off  to  the   nearest  integers.     This  is  bad.  But  we  are  the  Ninja-­‐Reversers  aren’t  we?  So  well,  either  we  can  find  out   why  this  happens  by  googling  things  related  to  “use  of  prime  numbers  in  calculating   hash  values”,”Integer  overflows”  &  lots  more  or  simply  do  it  the  easy-­‐peasy  way.   Lets  write  another  java  code  that  reverses  the  algo  &  since  its  pretty  simple,   bruteforces  it  to  get  us  the  right  value.  What  say?  Let  me  show  you  the  code  I  made.         Guess  what?  It  works!  J  Apparently  “-­‐975145735”  is  supposed  to  be  the  right   value.  Lets  give  it  a  try  in  the  actual  crackme.  Shall  we?  ;)                   And  that’s  how  its  done,  dutch.  I  hope  you  learnt  something  new  out  of  this  tutorial.   I  sure  did  enjoy  reversing  this  one.    Have  a  wonderful  day  ahead!     ©  Aodrulez   (  atul.alex@orchidseven.com  )