░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░           
░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░           
░▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒░           
░▒▓███████████████████████████████████████████████████████████████▓▒░           
░▒▓█ ▄▄▄▄▄ ▄     ▄▄▄▄▄ ▄▄▄▄  ▄▄▄▄▄ ▄▄▄▄▄                         █▓▒░           
░▒▓█ █     █       █   █   █ █     █                             █▓▒░           
░▒▓█ ▀▀▀▀█ █       █   █   █ █▄▄   ▀▀▀▀█              ▄▄▄▄       █▓▒░           
░▒▓█     █ █       █   █   █ █         █             █           █▓▒░           
░▒▓█     █ █       █   █   █ █         █ ▄▄▄   █▀▀▀▄ █▀▀   █▀▀▀█ █▓▒░           
░▒▓█ ▄▄▄▄█ █▄▄▄▄ ▄▄█▄▄ █▄▄▄▀ █▄▄▄▄ ▄▄▄▄█ █▄█   █   █ █     █▄▄▄█ █▓▒░           
░▒▓█                                                             █▓▒░           
░▒▓███████████████████████████████████████████████████████████████▓▒░           
░▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒░           
░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░           
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░           

seiranib presents...

    HOW TO GET MUMPS 30 YEARS LATER
          or
              hacking the government with foia'd code


Because of the way that the slides were made for this talk, they
can be provided as a text document.  So here we go!

╔══════╗ 
║AGENDA║ 
╚══════╝ 

* A Short History (of course)
* Breaking MUMPS
* The Future and Past

┌────────────────┐
│Some Definitions│
└────────────────┘

* EMR: Electronic medical records
* VA: Department of Veterans Affairs
* FOIA: Freedom of Information Act

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30                                 M3YL  seiranib 02/64

╒═════════╕█████████████████████████████████████████████████████
│Who Am I?│█████████████████████████████████████████████████████
╘═════════╛█████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
* My name is Zachary (seiranib) Minneker████████████████████████
* I work for Security Innovation████████████████████████████████
* I  /don't/  work for the government ██████████████████████████
* I used to work in health care kinda, now I break health care██
  stuff because I think it matters a lot████████████████████████
* Also I care a lot about history███████████████████████████████
╓──────────╖████████████████████████████████████████████████████
║Obligatory║████████████████████████████████████████████████████
╙──────────╜████████████████████████████████████████████████████
* I am speaking on behalf of myself and not my employer█████████
* These slides were created in Moebius (except some images)█████
  * The slides are available as a text file ending with .nfo!███
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30                                 M3YL  seiranib 03/64 

╔═══════════════════════╗███████████████████████████████████████ In the 
║WHAT'S THIS TALK ABOUT?║███████████████████████████████████████ original
╚═══════════════════════╝███████████████████████████████████████ presentation
████████████████████████████████████████████████████████████████ xkcd 2347 is
████████████████████████████████████████████████████████████████ here
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30                                 M3YL  seiranib 05/64                                                                                 

╔═══════════════════════╗ ██████████████████████████████████████ 
║WHAT'S THIS TALK ABOUT?║███████████████████████████████████████
╚═══════════════════════╝███████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
█████████████████████████████████This talk is about hitting█████ Like, look up
██████████████████████████████████that little block with████████ the xkcd, 
██████████████████████████████████████████a hammer.█████████████ this will make
████████████████████████████████████████████████████████████████ sense
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30                                 M3YL  seiranib 06/64                                                                                 

╔══════╗                                                        
║Origin║                                                        
╚══════╝                                                        
                                                                
* In 1966, a group of engineers under Octo Barnett, including   
  Neil Pappalardo, began working on a new language              
                                                                
          Massachusetts General Hospital                        
          Utility Multi-Programming System                      
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 08/64                                                                                 

A TON of people worked on MUMPS over the years that I don't have time to
mention.  Neil Pappalardo is usually credited as the creator, along with
"others".

╒════════════╕                                                  
│The Hardhats│                                                  
╘════════════╛                                                  
* MUMPS was SPECIFICALLY created for healthcare environments    
                                                                
* It was originally written for PDP-9s, and then DEC rewrote it 
  to make it into a stand-alone OS (!) called MUMPS-11 for      
  PDP-11s                                                       
  * Some say the original was a PDP-7                           
  * Originally installed at a site in May 1971, in Denver       
                                                                
* Lots of influence from BBN TELECOMP                           
                                                                
                                                                
* (this information is being gathered from an email exchange on 
   comp.lang.mumps from 1996, btw)                              
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 10/64 

╔═════════════╗
║The Olde Days║
╚═════════════╝

* This was pre-Unix! There were no standards! The Unix epoch
  didn't exist yet!

* This isn't a language: it's a programming environment!

  * The current time is stored in $HOROLOG as two numbers
    separated by a comma, the first of which is the number of
    days since January 1st 1841

  * The maximum date is December 31, 9999.
    * Y2K Compliant!

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 11/64

Source for this and the historical notes about PDPs and stuff:
http://71.174.62.16/MDC/faq.htm#_27_ (gardner_1998)

╔═════════════════╗                                             
║Making MUMPS Work║                                             
╚═════════════════╝                                             
                                                                
* MUMPS wasn't well standardized, but 2 engineers (Ted O'Neill  
  and Marty Johnson) were hired to explore using it at the VA   
                                                                
* They started developing utilities to help computerize         
  hospitals in the VA system.  Eventually this coalesced into a 
  single, total EMR: VistA                                      
  * You get it? Capital V, capital A?                           
                                                                
* The group of developers working on this, completely           
  decentralized, were called The Hardhats                       
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 12/64 

╒════════════════════════════════╕                              
│Vista and MUMPS Through The Ages│                              
╘════════════════════════════════╛                              
                                                                
* VistA grew through the years, and became well loved and       
  respected                                                     
  * On the one hand, this is an EMR made by people that are     
  using it every day. On the other hand, its enterprise grade   
  shadow IT                                                     
                                                                
* MUMPS was an extremely fast, no-SQL (even before SQL hit the  
  market) database, and found uses in things that needed a db   
  for storing a lot of extremely active data: banks, science,   
  hospitals                                                     
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 14/64 

╔═══════════════╗
║The Current Day║
╚═══════════════╝

* VistA is used to this day by the VA in hospitals across the
  US, and hospitals all over the world use it. Doctors love it.
  * Efforts to "modernize" the VA have led the VA to start to
    move away from VistA, but its still deployed all over

* MUMPS is still widely used in other health products, from
  some of the biggest EMRs to core banking
  * "Allscripts, Epic, Coventry Healthcare, EMIS, Partners
    HealthCare (including Massachusetts General Hospital),
    MEDITECH, GE Healthcare ..., Sunquest Information Systems,
    DASA, Quest Diagnostics, and Dynacare, among others.↔[Okane,
    2017, Introduction to the Mumps Language]
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 15/64

That full OKane citation is in the citation section at the bottom of the file.
OKane has written a lot of MUMPS related stuff, and has used in classrooms for
a while now, it looks like he's still at it.  He's written implementations of
the language specifically for teaching, as well.

╓────────────────────────────╖                                  
║Getting MUMPS, Getting VistA║                                  
╙────────────────────────────╜                                  
                                                                
* MUMPS can installed with sudo apt install -y fis-gtm to       
  install FIS' GT.M, which is a MUMPS implementation            
                                                                
* VistA was at some point victim of a vicious Freedom of        
  Information Act request, and so the VA literally uploads      
  it to an FTP server every month                               
  * This appears to have started around September 2004          
                                                                
                                                                
                                                                
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 16/64 

I've been trying to figure out exactly /why/ the FOIA got filled out in the
first place, but its sorta unclear.  Allen Arthur sort of implies that this
might have been part of efforts to provide a low cost EMR outside of the VA, 
but mentions this particularly in reference to Rep. Pete Stark.  But Stark's
legislation that would have provided VistA to medical providers was written in
2007/2008.

                                                                
    ╔════───  ──  ─  ──  ─ ░ ────  ─  ──    ─  ───  ───════╗    
               ▒    █ ▓   ░█░▓    █ ██████ ▓▓███▓               
               █    █ ▓    █ █    █ █    █ ▓                    
    │          ██  ██ █    █ ██  ██ █    █ █               │    
    │          ██ ░██ █    █ ██  ▓█ █    █ █                    
    │          █ ██░█ █    █ █ ▒▒ █ █    ▓ █                    
               █ ██ █ █    █ █ ░░ █ █████▓ ██████          │    
               █    █ █    █ █    █ █           █          │    
               █    █ █    █ █    █ █           █          │    
    │          █    █ █    █ █    █ █           █               
               █    █ █    █ █    █ █           █               
    │          █    █ █    █ █    █ █           █          │    
    │          █    █ █    █ █    ▓ █           █          │    
               ▓    █ ▒▒  ░█ █    ▓ ▓           █               
               ▒   ░▓░▓▓████░▓░   ▓ ▓      ▓█████               
    ╚════───  ─░─  ░░░░▒─ ░ ░░────    ─     ─   ──  ───════╝    
                                                                
╒═══════════════╕                                               
│MUMPS is Weird!│                                               
╘═══════════════╛                                               
                                                                
* In MUMPS, 3 + 6 * 2 is 18! This is because it reads math      
  strictly from left to right.  It only gets weirder from here! 
                                                                
* In general, its a pretty readable language. But its from a    
  time where size was at a premium                              
  * Most code is not commented!                                 
  * Keywords in the language can be shortened to single letters 
    in many situations                                          
                                                                
                                                                
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 18/64 

There's a lot of other oddities about MUMPS that are worth talking about.
Primarily, MUMPS is a language from the /before times/, and in my opinion its
really REALLY similar to writing assembly.  Its missing a lot of higher level
constructs that would be developed in the decades after its creation, and it
interacts with control flow in a really assembly-ish way.  Functions are more
like named areas, and you can hop into the middle of them by calling the 
function name plus a number of lines to skip.  There's a lot of other weird
little things that are very of-their-time, including the following.

╔═════════════════╗
║Normal MUMPS Code║
╚═════════════════╝


                 Set a=1
                 If a=1 Do
                 . Set a=0
                 . Write a 
                 . If a=0 Do
                 . . Set a=1
                 . . Write a
                 . Else  Do ; There's 2 spaces there!
                 . . Set a=2
                 Write a

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 19/64

That's completely normal MUMPS. Set sets a variable (which has been previously
created with the "new" keyword) to a value. If and else obviously are part of
if/else 

╔════════════════╗
║Small MUMPS Code║
╚════════════════╝


                 S a=1
                 I a=1 D
                 . S a=0
                 . W a 
                 . I a=0 D
                 . . S a=1
                 . . W a
                 . E  D ; There's 2 spaces there!
                 . . S a=2
                 W a

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 20/64

So that's sort of the first layer of optimization.  You can shorten any keyword
to the shortest non-ambiguous shortening.  Because there's not a ton of keywords
to begin with, that means you can shorten "set" to just "s". "If" becomes "i",
"else" becomes "e"...

There's another /pretty wild/ optimization we can do.  So far we've been seeing
MUMPS in so called "vertical mode".  But we can do "horizontal mode":

╔══════════════════╗
║SMALLER MUMPS CODE║
╚══════════════════╝





  s a=1 i a=1 d  s a=0 w a i a=0 d  s a=1 w a e  d  s a=2 w a




                 THIS IS BASICALLY CODE GOLF


▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 22/64

In the original presentation, there's two snippets of code from the VistA
codebase to demonstrate what real MUMPS code looks like.  I don't wanna type
all of that out, but generally speaking the liberal use of shortened keywords
and mixing vertical and horizontal modes makes the code extremely difficult to
read.

╔═══════════╗
║Using MUMPS║
╚═══════════╝

* Modern MUMPS implementations, namely GT.M and YottaDB are both
  interpreted and effectively ahead of time compiled
  * You write code, and its stored as .m files.  You then ask
    the MUMPS implementation to link and run the source and it
    checks if it can find a compiled version of the code.  If
    not, it compiles the code into a shared object, and loads
    it into memory

* Applications written in MUMPS, like VistA, are often released
  as source.  Users then compile and load sections from disk
  as needed

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 25/64

╔══════════════════════════╗
║How Does VistA Fit In Here║
╚══════════════════════════╝

* VistA is FTP'd up to a VA server as the "FOIA" version of
  VistA

* A couple different groups gather that and package it together

* On a deployed FOIA VistA server using GT.M, for example,
  VistA's MUMPS source is stored as routines (usually in a
  directory simply called r/)




▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 26/64

So a VistA install that relies on GT.M (or YottaDB, which has a shared codebase)
will read the VistA source code, parse it and compile it, and store it as a
shared object in its routines directory.  When you try to run something that's
in the routines directory, the MUMPS runtime loads that shared object into
memory.  So in normal operation, you tell it to run a routine, it checks to see
if it has that compiled, and if so loads the shared object and skips the compile
step.


                       THEN... I SHOWED UP                       This slide is
                       THEN... I SHOWED UP                       a replacement
                       THEN... I SHOWED UP                       for a graphic
                       THEN... I SHOWED UP                       saying the same
                       THEN... I SHOWED UP                       thing
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP
                       THEN... I SHOWED UP

                                                              
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 27/64 

╓─────────────────────────────────╖                             
║How Did I Get Wrapped Up In This?║                             
╙─────────────────────────────────╜                             
                                                                
* At SI, we have research time to work on interesting code and  
  learn how to break new, interesting things                    
                                                                
* I've been using mine to break different pieces of health care 
  software like HL7 protocols or other open source EMRs         
                                                                
* I'd heard of VistA, but (to be frank) didn't realize it was   
  MUMPS and how foundational MUMPS was to a lot of health care  
  software                                                      
  * Places I've worked at have always used Java-based EMRs      
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 28/64 

╒═══════════════════════════════╕                               
│The Everlasting Pursuit of Cool│                               
╘═══════════════════════════════╛                               
                                                                
                                                                
                                                                
                                                                
                                                                
         I wanna be cool.                                       
         I wanna hack weird code.                               
         (I think I've proven that VistA is weird code.)        
                                                                
                                                                
                                                                
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 29/64 

┌─────────┐
│The Stack│
└─────────┘

                                           ►►►►►►
          ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀     RPC      ►Client►
          █VistA████████████◄═══════════►►►      ►►
          ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀   ([XWB])    ►(CPRS)►
          █MUMPS████████████               ►►►►►►
          █Implementation███
          ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
          █Operating System
          ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
          █Hardware      ███


▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 30/64

This is what a sort of idealized VistA deployment looks like.  You have some 
hardware, on which the OS is running.  A MUMPS implemenation is then running on
that, like YottaDB or GT.M, and accesses memory and system resources via the OS.
Then, VistA is ran on that MUMPS implementation.  This means that MUMPS handles
a lot of the system things, like the sockets and the memory management, but then
the business logic is all in the VistA source code.  So VistA itself handles
the RPC, for example, and has code describing how to handle it.

╓────────────────╖                                              
║Finding a Client║                                              
╙────────────────╜                                              
                                                                
* My first thought is that I want to attack this as if I'm a    
  normal client on the network, so I need to look at a normal   
  client that interacts with VistA: CPRS                        
  * CPRS is widely available, written in Delphi                 
                                                                
* So I install CPRS, run a version of VistA deployed without    
  TLS (this is not hard), and start capturing packets           
                                                                
                                                                
                                                                
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 31/64 

Three slides are missing here. My goal is to attack VistA in some way. The most
realistic attack vector is the same way that clients interact with a VistA
deployment: via RPC over the network.  When initially performing the research,
I approached this first before learning MUMPS, because my assumption originally
was that I just wanted to reverse the RPC protocol and attack via it.  The 
decision was made to stick with CPRS, and attack the RPC mechanism that it uses,
which I'm gonna call XWB.

There's, if I'm correct, four RPC mechanisms that VistA can use that all have
the same first function in the VistA code.  Without getting too deep, RPC 
traffic is read off the socket by setting it as the current device in MUMPS
terms, and then the information that is read is checked to see how it starts.

Disconnect messages start with #BYE#, but other message types start with some
type of header.  XWB starts with "[XWB]". The rest of the protocol is
complicated, and because it didn't lead to any major findings I'm going to skip
it mostly, but here's an example from slide 35:

[XWB]10304\x0aTCPConnect50009127.0.0.1f00010f0009127.0.0.1f\x4

One of the interesting things to note, I think, is that the protocol mixes
literal hex numbers and decimal representations of sizes.  For example, the \xa
following "10304" is the size of the next field, which is the actual RPC call
being made (TCPConnect in this case), but then the decimal number 9 is used to
transmit the size of the argument to the call, 127.0.0.1.

My goal is to attack this RPC in some way, and I don't really know MUMPS yet.
So I plan on using BooFuzz.

┌────────────┐
│BooFuzz Time│
└────────────┘

* So I turn to ole reliable: BooFuzz

* To make a BooFuzz script, I need to capture a lot of traffic,
  and then convert that traffic into the script itself

* I did about 20 RPC calls before I was like "no, actually" and
  wrote a script to do the rest for me

* So, now I have a 18 KLOC BooFuzz script!

  ... that gets me nothing!

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30███████████████████████████████  M3YL  seiranib 36/64

╔═══════════╗                                                   
║Switch Tack║                                                   
╚═══════════╝                                                   
                                                                
* So, switch tack: I write a harness that takes input from      
  stdin and feeds it to [XWB] RPC parsing code                  
                                                                
* For this, I want to use AFL++ in dumb mode to feed input to   
  VistA                                                         
                                                                
* This doesn't appear to be working, so I'm like "well, I       
  should get some visibility into the MUMPS runtime, so I'm     
  going to instrument the underlying MUMPS implementation which 
  handles the sockets/memory/etc"                               
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 37/64 

╒══════════════════════════════════╕
│Intrumenting MUMPS Implementations│
╘══════════════════════════════════╛

* There's a couple MUMPS implementations that seemed worth
  attacking here: GT.M and YottaDB
  * YottaDB is based on GT.M because of historical reasons
  * The GT.M deployment I was working with was based on GT.M

* Both YottaDB and GT.M are made by C wizards who are way cooler
  than me
  * For instrumentation this means we have to make 3-ish patches
    to make AFL++ work



▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 38/64

╓───────────────────────────────╖
║Attacking MUMPS Implementations║
╙───────────────────────────────╜

* Since I'm instrumenting the MUMPS implementation in order to
  get visibility on the RPC, I might as well fuzz the MUMPS
  source compilation logic anyway

* YottaDB has a lot of existing source code examples that they
  use for test-driven development, which make a perfect, no
  thinking required fuzzing corpus





▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 39/64

┌─────────────┐
│Source Review│
└─────────────┘

* At this point, I finally read MUMPS!

* I start tracing authentication, input handling, and system
  interactions for quick wins








▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30███████████████████████████████  M3YL  seiranib 40/64

╔═════╗
║Recap║
╚═════╝

* First, we're fuzzing VistA's RPC using a MUMPS harness and
  AFL++

* Second, we're fuzzing MUMPS' source code parsing in two
  implementations, GT.M and YottaDB, using YottaDB's TDD tests

* Third, we're reviewing VistA's source by hand





▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 41/64

               SO!          WHAT'D WE GET???
               SO!          WHAT'D WE GET???
               SO!          WHAT'D WE GET???
               SO!          WHAT'D WE GET???
               SO!          WHAT'D WE GET???

╒════════════════╕                                              
│Fuzzing Findings│                                              
╘════════════════╛                                              
                                                                
* RPC fuzzing got us nothing :(                                 
  * (There's a boring technical reason for this I don't have    
    time for)                                                   
                                                                
* Fuzzing YottaDB and GT.M got us 30 CVEs, all from memory      
  corruption bugs                                               
  * Everything from buffer overflows to use after frees to      
    null pointer dereferences to function pointer overwrites    
                                                                
* These bugs are in how the MUMPS compiler and runtime handle   
  source code, so the attack surface is sorta specific          
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30███████████████████████████████  M3YL  seiranib 43/64 

The boring technical reason has to do with how VistA manages clients.  Basically
I have boofuzz sending a hello message, then a fuzzed message, and then just
dropping the connect.  VistA, however, is waiting on #BYE# and never gets it. So
I have to reboot the instance over and over again, making very little progress.

╓────────╖
║The CVEs║
╙────────╜

* The CVEs are CVE-2021-44481 to CVE-2021-44510

* These memory bugs are weird! This is a piece of software that
  has been developed by greybeards for 30 years at this point
  * They do every possible trick you can think of, and that
    leads to weird states!






▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 44/64

┌────────────────────────────┐
│Let's Look at CVE-2021-44486│
└────────────────────────────┘

* First, I'm going to show you the crashing input and the crash
  itself, then I'm going to explain why this happens, and then
  I'll show you the whole crash again









▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30███████████████████████████████  M3YL  seiranib 45/64

Ok, well, that's a lie here. I can't show you the video because this is text. So
instead, let me just explain it and we'll hope.  First, I show the input, which
specifically contains a lot of calls to "write" in mumps, as well as several
calls to zcompile which will attempt to compile the input.  Then, I start GDB.
GDB segfaults somewhere in the heap memory of the executable.  I show the memory
around where the crash occurs (btw, the reason it crashes is cause that section
of memory is rw, but not execute).  Then I travel up the call stack to the 
calling function before the crash, which is /sr_port/op_write.c.  There, at line
55, we see a call to io_curr_device.out->disp_ptr->write.  I print that object
and demonstrate that write is set to the memory address that we crashed at.
write, in this case, is a function pointer.  I'll explain that in a moment.

┌─────────────────────┐
│Why Is This Happening│
└─────────────────────┘

* A specific order of strings being created and compile commands
  being performed is corrupting a data structure which contains
  a function pointer

* This function pointer is then used in a subsequent call to
  write.  Because the function pointer is corrupted, the call
  jumps out to the middle of un-executable code
  * the location we're jumping to here is somewhere on the heap
    just by happenstance



▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30███████████████████████████████  M3YL  seiranib 47/64 

╔══════════════════════╗                                        
║What's Being Corrupted║                                        
╚══════════════════════╝                                        
                                                                
* This is what we're trying to execute (and how it should work  
  normally)                                                     
                                                                
      (io_curr_device.out->disp_ptr->write)(&v->str);           
       ┌─────────────────  ┌───────  ┌────                      
       │                   │         └> Func ptr to the write   
       │                   │            func for this device    
       │                   └> Ptr to this devices' dispatch     
       │                      table                             
       └> The current input/output device                       
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 48/64 

disp_ptr here has a ton of pointers to different function pointers.  What this
lets the developers of GT.M/YDB do is quickly and easily change what it means to
for example read into a file versus a socket, or write out to stdout rather than
a binary file.

╔══════════════════════╗
║What's Being Corrupted║
╚══════════════════════╝

* And after the corruption occurs, this is what this line of
  code actually does

      (io_curr_device.out->disp_ptr->write)(&v->str);
       ┌─────────────────  ┌───────  ┌────
       │                   │         └> Points to somewhere
       │                   │            sorta randomly
       │                   └> Points to somewhere sorta
       │                      randomly
       └> Corrupted!


▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 49/64

╒═══════════════════════════════╕
│How Does That Corruption Happen│
╘═══════════════════════════════╛

* Basically, we have two overlapped memory addresses. In other
  contexts, a similar attack is possible via a use after free
  or double free, where two pointers believe they own the same
  memory

* Lets take a look at the crash again.  I'm going to run YottaDB
  with the same input again, but this time we're going to stop
  right before the crash in op_write.c.




▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 50/64

So then I play a different video.  This time, I show the crash again, but then
we break inside of sr_unix/incr_link.c, at a call to malloc.  I show the
io_curr_device, and show that its fine.  But then we single step through the
code until we see a call to a macro that consumes the return value from malloc.
Then, I show io_curr_device again.  And everything is corrupted.  The call to
malloc returned the same value that io_curr_device exists at.

We run through the code again, breaking at the call to malloc.  Then we step 
into it, and find that its /not/ malloc: its gtm_malloc!  They replaced malloc
with their own memory allocator! I then step through the code, and show the
memory address that this new allocator is going to return, compared to
io_curr_device.out.  We see this:

(gdb) p uStor
$1 = (storElem *) 0x55555557e200
(gdb) p io_curr_device.out
$2 = (struct io_desc_struct *) 0x55555557e210

Off by 16 bytes.

╓───────────────╖                                               
║What Did We See║                                               
╙───────────────╜                                               
                                                                
* Before the crashing call, the io_curr_device.out object is    
  well formed, and at a memory address ending with 0x...e210    
                                                                
* A call to malloc does not go to GLibC malloc.  Instead, it    
  goes to a malloc created by the developers                    
                                                                
* That malloc returns a pointer to memory starting at 0x...e200 
                                                                
* The devs have created their own memory allocator inside of the
  heap, and with careful manipulation it can be made to return  
  addresses that overlap with critical structures               
  * There's at least 2 memory allocators in use                 
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30███████████████████████████████  M3YL  seiranib 52/64 

These next slides I'm sort of compositing together in a way.  In the real
presentation, the diagrams where smaller (which I did by generating pngs at 2x
the normal size of the slides, and then stretching them in place in powerpoint.
This version is more honest, I guess!

┌────────────┐
│Heap Diagram│
└────────────┘


                                              
               The Process      The Heap      
    0xF...FFFF┌─────────────┐ ┌┌─────────────┐
              │Etc          │ ││ Chunk       │
              ├─────────────┤ │├─────────────┤
              │Stack        │ ││ Chunk       │
              ├─────────────┤ │├─────────────┤
              │  ▼ Grows ▼  │ ││ Free        │
              │             │ │├─────────────┤
              │             │ ││ Chunk       │
              │             │ │├─────────────┤
              │             │ ││             │
              │             │ ││             │
              │             │ ││ Free        │
              │             │ ││             │
              │  ▲ Grows ▲  │ ││             │
              ├─────────────┤─┘├─────────────┤
              │Heap         │  │ A Chunk     │
              ├─────────────┤─┐├─────────────┤
              │BSS          │ ││ Free        │
              ├─────────────┤ │├─────────────┤
              │Data         │ ││             │
              ├─────────────┤ ││ Chunk       │
              │Text         │ ││             │
    0x0...0000└─────────────┘ └└─────────────┘
                                              

                                                                                       
 The Heap         A Chunk                                                              
┌─────────────┐ ┌┌─────────────┐0x...2B0 ◄──┐                                          
│ Chunk       │ ││             │            │                                          
├─────────────┤ │├─────────────┤0x...2A0    │                                          
│ Chunk       │ ││             │            │                                          
├─────────────┤ │├─────────────┤0x...290    │                                          
│ Free        │ ││             │            │                                          
├─────────────┤ │├─────────────┤0x...280    │                                          
│ Chunk       │ ││             │            │                                          
├─────────────┤ │├─────────────┤0x...270    │                                          
│             │ ││             │            │                                          
│             │ │├─────────────┤0x...260    │     During initialization, GT.M 
│ Free        │ ││             │            ├───► allocates a chunk, and then
│             │ │├─────────────┤0x...250    │     it manages that new space
│             │ ││             │            │     with its own memory allocator                                            
├─────────────┤ │├─────────────┤0x...240    │                                          
│ A Chunk     │─┤│             │            │                                          
├─────────────┤ │├─────────────┤0x...230    │                                          
│ Free        │ ││             │            │                                          
├─────────────┤ │├─────────────┤0x...220    │                                          
│             │ ││             │            │                                          
│ Chunk       │ │├─────────────┤0x...210    │                                          
│             │ ││             │            │                                          
└─────────────┘ └└─────────────┘0x...200 ◄──┘                                          
                                                                                       
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 53/64


┌────────────┐
│Heap Diagram│
└────────────┘

                                                 A Chunk that           
               The Process      The Heap      gtm_malloc handles        
    0xF...FFFF┌─────────────┐ ┌┌─────────────┐ ┌┌─────────────┐0x...2B0 
              │Etc          │ ││ Chunk       │ ││             │         
              ├─────────────┤ │├─────────────┤ │├─────────────┤0x...2A0 
              │Stack        │ ││ Chunk       │ ││             │         
              ├─────────────┤ │├─────────────┤ │├─────────────┤0x...290 
              │  ▼ Grows ▼  │ ││ Free        │ ││             │         
              │             │ │├─────────────┤ │├─────────────┤0x...280 
              │             │ ││ Chunk       │ ││             │         
              │             │ │├─────────────┤ │├─────────────┤0x...270 
              │             │ ││             │ ││             │         
              │             │ ││             │ │├─────────────┤0x...260 
              │             │ ││ Free        │ ││             │         
              │             │ ││             │ │├─────────────┤0x...250 
              │  ▲ Grows ▲  │ ││             │ ││             │         
              ├─────────────┤─┘├─────────────┤ │├─────────────┤0x...240 
              │Heap         │  │ A Chunk     │─┤│             │         
              ├─────────────┤─┐├─────────────┤ │├─────────────┤0x...230 
              │BSS          │ ││ Free        │ ││             │         
              ├─────────────┤ │├─────────────┤ │├─────────────┤0x...220 
              │Data         │ ││             │ ││             │         
              ├─────────────┤ ││ Chunk       │ │├─────────────┤0x...210 
              │Text         │ ││             │ ││             │         
    0x0...0000└─────────────┘ └└─────────────┘ └└─────────────┘0x...200 
                                                                        

  A Chunk that              That's a           That's a               
gtm_malloc handles       io_curr_device       routine hdr             
┌┌─────────────┐0x...2B0 ┌─────────────┐    ┌─────────────┐0x...2B0   
││             │         │ichset       │    │20646f20490a6│           
│├─────────────┤0x...2A0 ├─────────────┤    ├─────────────┤0x...2A0   
││             │         │newly_crea...│    │0616e6420736f│           
│├─────────────┤0x...290 ├─────────────┤    ├─────────────┤0x...290   
││             │         │...          │    │2072756c65732│           
│├─────────────┤0x...280 ├─────────────┤    ├─────────────┤0x...280   
││             │         │disp_ptr     │    │Random Addr  │           
│├─────────────┤0x...270 ├─────────────┤    ├─────────────┤0x...270   
││             │         │...          │    │e6f7720746865│           
│├─────────────┤0x...260 ├─────────────┤    ├─────────────┤0x...260   
││             │         │width        │    │0a796f75206b6│           
│├─────────────┤0x...250 ├─────────────┤    ├─────────────┤0x...250   
││             │         │error_hand...│    │46f206c6f7665│           
│├─────────────┤0x...240 ├─────────────┤    ├─────────────┤0x...240   
┤│             │         │io_log_nam...│    │6e67657273207│           
│├─────────────┤0x...230 ├─────────────┤    ├─────────────┤0x...230   
││             │         │io_log_nam...│    │e6f2073747261│           
│├─────────────┤0x...220 ├─────────────┤    ├─────────────┤0x...220   
││             │         │io_pair      │    │7765277265206│           
│├─────────────┤0x...210 ├─────────────┤    ├─────────────┤0x...210   
││             │         │  ▲          │    │▲            │           
└└─────────────┘0x...200 ◄──┴────────────────┘             0x...200   
                                                                      
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 53/64

╔═══════════╗                                                   
║But... why?║                                                   
╚═══════════╝                                                   
                                                                
* Basically we have two mechanisms managing the same memory,    
  malloc and gtm_malloc. Then, we have a type confusion-like    
  bug in due to way gtm_malloc handles that memory              
  * This is a heap exploitation bug inside a memory manager     
    managing memory that's also managed by the system memory    
    manager                                                     
                                                                
* The address that gets placed isn't completely random, but     
  its not super in our control                                  
                                                                
* I wanted to talk about this bug particularly because I think  
  its really wild                                               
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 54/64 

╒══════════════════╕
│Source Review Wins│
╘══════════════════╛

* Source code review focused on quick wins and looked at the
  auth mechanisms, input handling, and system interactions

* RPC access is gated by a mechanism that uses roll-your-own
  encryption from the 90s
  * If deployed without TLS, creds are poorly encrypted and
    transmitted in such a way that attackers can trivially
    decrypt them, or simply replay the packets

* There appears to be hardcoded creds in the source, but
  because of certain particulars, I'm not sure if they're
  usable
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 57/64

╓────────────╖
║Im srry lmao║
╙────────────╜

* I tried super hard to get
  this disclosed in time, but
  we had some issues there.
  And its not super sporting
  to kiss and tell, so...







▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 58/64

Yep! I can't talk about how the auth mechanism works!  Here's why: we cannot get
a hold of someone at the VA to talk about it.  Here's how disclosure has gone:

┌───────────────────┐
│Disclosure Timeline│
└───────────────────┘

* Jan 3rd 2022: first contact with VA following their VDP.  Received an 
  automated email. No further contact.                    
                                                                                                                                
* Jan 10th 2022: second contact with VA following their VDP.
  Automated email, no further contact.                              
                                                                                                                                
* Feb 10th 2022: third contact with VA following their VDP.  No response.                                                       
                                                                                                                                
* Mar 22nd 2022: reached out to DHS contact. No response.                                                                       
                                                                                                                                
* Apr 6th 2022: reached out to CISA. No response.                                                                               
                                                                                                                                
* May 23rd 2022: called CISA literally on the phone, got disconnected, 
  no response.                                             
                                                                                                                                
* May 27th 2022: called CISA again.  Was told that any information provided 
  would not be provided to the VA to fix the issue.   
                                                                                                                                
* May 27th 2022: reached out to CMU CERT. Received follow up email with 
  questions.  We responded, then they never responded.    

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 60/64

But here's how disclosure to the devs went.  Super swimmingly!

┌───────────────────┐                                           
│Disclosure Timeline│                                           
└───────────────────┘                                           
                                                                
* YottaDB                                                       
                                                                
* Nov 30th 2021: First contact with vendor                                     
                                                                               
* Dec 1st 2021: Vendor confirms reports, begin working on fix immediately      
                                                                               
* Dec 7th 2021: Spoke to the dev team explaining methodology                   
                                                                               
* Dec 8th 2021: Merge request for fuzzing changes, vendor takes over fuzzing   
                                                                               
* Feb 25th 2022: New version released!                                         
                                                                                                                                               
* GT.M                                                          
                                                                
                                                                                  
* Dec 1st 2021: First contact with vendor                                         
                                                                                  
* Dec 3rd 2021: Vendor confirms reports, begin working on fix immediately         
                                                                                  
* Mar 30th 2022: New version released!                                            
                                                                                  
                                                                                  
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
█DEFCON 30███████████████████████████████  M3YL  seiranib 60/64 

YottaDB specifically were great.  We had a long conversation about method and
approach, I spoke to their devs, some of whom have been working on this same
code for decades, about how they approach it.  One of my favorite anecdotes
that they shared was that in development, at some point one dev said to another
"Hey, have you seen the weird stuff that AIX (iirc) is doing for memory
protections?" and the other said "No, what?".  "Well, they've got these stripes
of memory throughout writable memory that are marked no read, no write, no exec,
and then if you get a buffer overflow, you crash!"

"Wow!" said the second dev. "Wait a minute isn't that just mprotect doing
PROT_NONE?"

And that's how GT.M/YDB ended up with guard pages WAY before they were popular.

Here the colors in the slides change radically, but I'm gonna keep the black 
background for this file.

┌───────────────────────────┐                                   
│So What Does This All Mean?│                                   
└───────────────────────────┘                                   
                                                                
* When I started this I sorta figured that memory corruption    
  bugs in big products were dead as hell                        
  * NOPE!                                                       
                                                                
* MUMPS isn't going anywhere                                    
  * When MUMPS first got started, it was faster than everything,
    it was inventive, it was cutting edge; a ton of industries  
    jumped on it, from banks to health care, and are still there
    now                                                         
  * 54% of health care records touch MUMPS in some form         
                                                                
* There's still more weird machines out there to break!         
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30                                 M3YL  seiranib 61/64 

╔═════════════════╗                                             
║What Should I Do?║                                             
╚═════════════════╝                                             
                                                                
* If you're working on a VistA or derived product,             '
  verify you're using TLS everywhere!                           
                                                                
* If you deploy a MUMPS-based product and use YottaDB or GT.M,  
  update!                                                       
  * If you use GT.M from apt, you're four versions behind and   
    you should probably build from source                       
                                                                
* If you're a hacker looking for research,  I can't think of    
  a better broad umbrella to be looking under than medicine     
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30                                 M3YL  seiranib 62/64 

╒═══════════════════════════════════════════╕                   
│Everyone Who Worked On This Is A Hero To Me│                   
╘═══════════════════════════════════════════╛                   
* I'm not kidding                                               
                                                                
* MUMPS was this incredible idea from 1960something that is an  
  ANSI standard, has been continually developed into something  
  incredible across all the implementations, ideas, and years   
                                                                
* VistA is this well respected, easy to use, flexible, and      
  by-doctors-for-doctors, that was then released into the world 
  to help provide those same tools to as many people as possible
  * btw it was named vista in 1994, almost 30 years ago, cause  
    it was originally called DHCP which led to some problems    
                                                                
                                                                
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30                                 M3YL  seiranib 63/64 


     seiranib presents... mumps at          
                                            
  ███▓░  ▓██▓▒  ░░▒▒▓░ ████▒░ ▓▓▒▒░  ▒   ▒  
  █░  ▓  ▒▒  ░  ░░     █▒░    ▓░  ░  ▓▒  ▒  
  █   █  ░▒█    ░▒▒░   █░     █   ░  ▓░▒ ▒  
  █   █  ░░     ░      █      █   ░  ▒ ▒░▒  
 ▒█   ▓  ░      █      █      █░ ░░  ░  ▒▒  
 ▒███▓░ ▒██░▓  ▓█     ▓███▓░  ██▒▒░  ░  ▒▒  
 ░░▒    ░▒     ░░    ░░▒▓               ░▒  
  ░                                         
                                            
  ▓████ thirtythirtythirtythirtythir █████  
     ░█ tythirtythirtythirtythirtyth █   █  
   ░▓██ irtythirtythirtythirtythirty █ █ █  
     ░█ thirtythirtythirtythirtythir █ █ █  
    ░▒█ tythirtythirtythirtythirtyth █░  █  
 ░▒▓███ irtythirtythirtythirtythirty░▓███▓  
  ░                                 ░▒      
                                            
                                            
  ████▓  ████▓  ████▓░ █████▓ ▓███▓ ░▓███▓  
  █░     █░  █  █░     █░░  ░   █    ░  █   
  █      █████  ██▓░   ███▓     █      █    
  █ ▓██  ███    █      █        █      █    
 ░█   █  █  █   █     ░█        █     █     
 ▒█████▒▒▓░░░▓ ░▓███▓ ░▓███▓▒   ▓   ▒████▓▒ 
                                            

┌──┐┌──┐┌──┐For the inspiration
│  ││  │   │and mentioning Moebius
│  ││──┘   │
└  ┘└──┘   ┘   KS Bhaskar and the crew
┌──┐┌──┐┌──┐     at YottaDB
└──┐│  ││  │
│  ││──┘│  │
└──┘└   └──┘
┌──┐┌  ┐┌  ┐
│  │├──┘│  │
│  ││  │└──│         shoutz to the DC30
└──┘└  ┘└──┘         crew for being super
                     flexible & helpful!
     ▒ ▒▒▒ ▒  ▒  ▒
  ▒▒▒▒ ▒  ▒▒▒ ▒▒▒▒
  ▒  ▒ ▒   ▒     ▒
  ▒▒▒▒ ▒   ▒  ▒▒▒▒
                 
  ▒▒▒▒ ▒   ▒▒▒▒▒ ▒    whoisjoe.com
  ▒    ▒▒▒ ▒  ▒  ▒
  ▒▒▒▒ ▒ ▒ ▒▒▒▒▒ ▒
  for listening to me
  complain about mumps

            https://h3rmitthefr0g.dev/,
            LeJIT, @Zonr0, @Din3zh,
            and everyone else
            I'm forgetting at
            Security Innovation,
            The application security
            company

kdolan503

 Queercon and queer hackers
 every where


                  hi mom hi dad
             charlie buy louder drums


             Max Dulin for teaching
             me how to pwn the heap






      David Zeichick, Tyson Henry
      and the rest of the staff at
      csu chico





  TWIABP&IANLATD for illusory
                   walls



          tysm david! ♥



   Hey Martin!


      Slides created in 2022 on an x86
      macbook somewhere in the PNW in
      moebius by Andy Herbert


????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????
??????????                                            ??????????
??????????                                            ??????????
??????????      Thanks so much for your time!         ??????????
??????????                                            ??????????
??????????       questions, etc?                      ??????????
??????????                                            ??????????
??????????                                            ??????????
??????????                                            ??????????
??????????         also, you can yell at me on        ??????????
??????????     twitter @seiranib                      ??????????
??????????             (its "binaries", backwards)    ??????????
??????????                                            ??????????
????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
 DEFCON 30                                 M3YL  seiranib  done 


CITATIONS


@misc{allen_40-year_nodate,
	title = {A 40-year 'conspiracy' at the {VA}},
	url = {https://www.politico.com/agenda/story/2017/03/vista-computer-history-va-conspiracy-000367},
	abstract = {The story behind perhaps the most important medical computer system in history.},
	language = {en},
	urldate = {2022-06-29},
	journal = {The Agenda},
	author = {Allen, Arthur},
}


@misc{gardner_1998,
  title={M Technology and MUMPS Language FAQ},
  url={https://web.archive.org/web/20220419235946/http://71.174.62.16/MDC/faq.htm}, 
  journal={M technology and MUMPS LANGUAGE FAQ}, 
  author={Gardner, Trask S}, 
  year={1998}, 
  month={Apr}
} 


@misc{okane_quick_2017,
	address = {University of Northern Iowa},
	title = {A {Quick} {Introduction} to the {Mumps} {Programming} {Language}},
	url = {https://www.cs.uni.edu/~okane/source/MUMPS-MDH/MumpsTutorial.pdf},
	author = {O'Kane, Kevin},
	month = nov,
	year = {2017},
}

@misc{bhaskar_yottadb_2021,
	title = {{YottaDB}},
	url = {https://gitlab.com/YottaDB/DB/YDB},
	abstract = {GitLab.com},
	urldate = {2022-07-08},
	author = {Bhaskar, KS and Westhafer, Brad  and Iyer, Narayanan and Sikri, Jaahanavee and Estes, Steven and Habiel, Sam},
	month = feb,
	year = {2021},
}
