So after I posted my video write-up about the JS Safe challenge from the Google CTF
I got a lot of valuable feedback and some corrections, that I think deserves a very
quick update video.
If you haven't seen that one, this video makes probably not that much sense, so check
that out first.
So let's quickly go through the different points that were raised by viewers.
First: I had this theory that weird JavaScript namespacing due to the with statement caused
the different x values to be passed to the function.
Onetime it was the function itself, onetime it is the parameter.
But it turns out I got FOOLED!
Those are not the same character.
The function name x is a regular ascii x, it is the same character as the x in the hex
variable and so forth.
But the parameter x is actually a different unicode, it's a cyrillic x.
Visually it looks exactly the same, but for the computer it's like it is a completely
different letter and this a very different variable.
And by searching for that cyrillic x you see that the parameter is used in the inner x,
but it's not the x outside.
What do we learn from that?
Let's not always assume JavaScript is f'ed up, that's actually very logical and probably
works in any language exactly like that.
The second kind of correction I got was about the cause for the crash.
I couldn't really make sense of it and theorized it had to do with some kind of recursive call
of toString or something, but it turns out, it is in fact triggered by the toString, but
crashes for a very different, much more logical reason.
So source is a regex, it's not a string.
You see it starts and ends in a slash, not quotes.
And the c function takes the length of the first parameter a, and a in this case is source
and a regex doesn't have a length.
So if you write the loop like this, loop until i is equal to the length of source, then yeah,
that never happens.
The length of source is undefined.
I will never be undefined.
So you have an endless loop that freezes the tab too long and gets killed.
Now if it was written like you usually see a for loop, with a less than, then i would
not be less than undefined and the loop would never run.
So what do we learn here?
Read the code more carefully, if I had debugged that properly I would have understood that
better.
I actually thought about the regex vs a string for a bit, but mostly because of toString
and wondered what kind of effect that could have.
And I was also confused by the weird way the for loop is written, but I ignored it as a
style choice of the author.
So I saw all the traces, but didn't get to the correct conclusion.
Shame on me.
And another feedback I got was about my comment on namespacing.Saying that the let statement
binds variables to a block scope and I should use that instead, however in this case a var
variable would have achieved the same result in terms of not influencing eachother, because
var binds to the function scope and h is it's own function.
However in principle there is a difference.
Let binds even stronger to a block.
So for example inside and outside of a loop.
Here just a quick example to show that var works here as well.
So this is basically the skeleton of the JS safe code to test the variable scoping.
We have a function that contains another function and a for loop.
The for loop uses a to count up, and the function inside here also uses a.
I added some console log output to see the value of a.
Now in this base example a is counted up to a thousand, which makes the global value of
a 1000 and that is then also still used inside the function h.
And setting a in there also influences the a outside.
If we now add the var statement as I suggested in the video then the scoping would change
slightly, separating the a inside of the function h from the other a.
So a at this point is obviously undefined and setting it also doesn't affect the global
a.
The same result is achieved with using let here, and sure let is also a good solution,
however if I'm nitpicky, I'd argue that in this case we don't want block level separation,
we want to separate a based on the function used.
And in this case I think var is the better choice?
Anyway.
I'm not a javascript expert.
Based on how completely wrong I read and interpreted the code, it's actually a surprise that
I was able to solve it.
So I guess this is an example that you don't always have to understand everything to solve
an issue, as long as you identify the core and approach it systematically.
Awesome, now all confusions I had about this challenge are cleared up.
The challenge and the code makes total sense now.
Thanks so much for your input, I always appreciate it, even if I get the same comment dozens
of times, I always learn from it and I can't repeat it often enough.
I'm so glad that I can put my work out there and not only show something cool to others,
but get feedback that helps me to improve as well.
For more infomation >> †: Some things I got wrong with JS Safe 2.0 - Google CTF 2018 - Duration: 5:30.-------------------------------------------
The 'Full House' When D.J. Helped An Alzheimer's Patient Escape A Nursing Home - Duration: 4:42.
(soft music)
- DJ's volunteering at a nursing home
with her adopted grandparent, Eddie.
Danny's proud she's spending time
in a giant refrigerator for expiring humans.
DJ doesn't know what to talk about with a 75-year-old man.
Joey says they have so much in common,
they both have dead moms!
Plus she can ask him about the Great Depression
or The Three Stooges.
Then they give her a quick refresher course
on what great depression looks like.
Meanwhile, Stephanie is training Comet
to jump over Michelle.
Cuuuuuute.
Kimmy says her dog Coco is way smarter
than this remedial retriever.
Stephanie says they should get all the dogs
in the neighborhood to come by and see who's the smartest.
Because that's a normal thing kids
definitely do all the time.
Eddie is playing high stakes cards at the nursing home
and just won $24,000?
Better collect from him soon, Eddie.
DJ's ice breaker convo about the great depression
is a bit stiff.
Until she cracks a smile that reminds Eddie
of his daughter Gloria.
He says Gloria's all grown up now in Florida
and he hasn't seen her since...
then he trails off...
What happened in Florida, Eddie?
Eddie says forget that Gloria chick, let's party!
Then invites DJ to get hustled at pool.
Meanwhile the B-story about Stephanie training a dog?
Who cares
and a C-story about Jessie learning
what it's like to be pregnant?
Double who cares.
DJ won three games and Eddie is down $24,000.
Jesus, Eddie, you've got a serious
imaginary gambling problem.
DJ has to get home to her backyard dog show
and Eddie says that sounds sick.
He loves dogs!
He ate one during the great depression.
DJ wonders if they need permission to leave
and he says nuts to that.
Eddie does what Eddie wants and that's on err-thing.
Eddie tells his friend he's getting the fuck up
out this smelly bitch, deuces.
His pal says he can't!
What if he has one of his spells?
Eddie says pipe down and hold this candy bar.
Then tells a nurse that geezer in the corner
is sneaking a Snickers!
And with the nurse distracted,
DJ unwittingly helps this old man escape.
DJ introduces Eddie to her pregnant Uncle
and her other Uncle who isn't really a forest ranger,
he just dresses like one for puppy parties.
DJ tells Eddie he can help judge the contest!
Eddie replies.
- Come on Gloria, you got to hurry,
you gonna be late for school.
- Uhhhh,
the fuck?
Seriously, what happened in Florida?
The dog show is going alright.
Everyone involved
majorly needs a hobby.
DJ and Eddie are having a blast judging these hounds.
DJ gave that dog four stars!
Eddie gave him a triangle next to a
lower-case J with three squiggles.
And a D-Story about Comet falling in love with Kimmy's dog?
Who cares high score.
Eddie sees Nurse Thomas and dips with haste.
Apparently, Eddie is not allowed to leave
without being signed out by a family member.
DJ says he forgot to tell her,
a likely story.
DJ finds Eddie in her room, calling her Gloria,
telling her to be nice or he's not gonna
let her watch Howdy Doody
Yikes.
Then Eddie says he's just playing.
DJ says the only game he's playing is hide and go seek
with the pissed off nurse in her kitchen.
Eddie tells her to chillax.
But DJ can't chillax because he's been lying all day.
And she's wondering if she'll ever see her $24,000.
Eddie fesses up.
Most of the time he's A-OK,
but every now and then
he's not A-Ok.
And he winds up at a backyard dog parade
with a teenage girl he met just hours ago.
Eddie says today was one of the best days
he's had in a while, and he's sorry for getting
DJ in trouble and if she doesn't wanna
see him again, he'll understand.
Danny explains he has Alzheimer's.
It's a scary disease that makes old people judge dog shows.
DJ wants to know if he's going to get better.
Danny says he's going to get worse.
He'll likely progress to cat shows,
then goldfish shows in his final days.
And just like her mom's roadside decapitation,
the doctors haven't found a cure yet.
DJ says this volunteering business sucks booty.
Danny says cheer up!
Because today was one of the best days Eddie can remember!
But take it with a grain of salt Deej,
because it's also one of the worst days he can remember.
It's one of the only days he can remember.
Eddie is telling the nurse he just saw a dog show,
a forest ranger, and a pregnant man.
She's making a note to increase his medication.
DJ invites Eddie to stay for dinner
and it seems like they're going to be friends!
Only we never see Eddie again,
because he probably fucking killed himself,
or at least made a plan to fucking kill himself
then forgot all about it.
So what did we learn today?
Old people in nursing homes are spending
their last moments on earth gambling with imaginary money,
and could really use some friendly volunteers
to get in on the action.
But if your adopted grandparent wants to follow
you to a backyard dog show,
make sure they're allowed to go,
or you might be unknowingly jail breaking
a senior citizen with Alzheimer's.
And backyard dog shows are remarkably
easy to put together in just a few hours
when all your neighbors are losers.
But if you let any rando judge your dog show for free,
you get what you paid for.
And we'll never find out what happened in Florida,
because Eddie most likely straight up murdered
a lady named Gloria and forgot where he hid the body.
See you next time on a very special episode.
-------------------------------------------
Live PD: Puddles in the Parking Lot (Season 2) | A&E - Duration: 3:12.
-------------------------------------------
9 Benefits You Will Have If You Eat Honey Every Day | Natural Health - Duration: 5:32.
-------------------------------------------
Es poco probable que exista vida alienígena inteligente, según estudio - Duration: 2:31.
-------------------------------------------
100 Unique Garden Gazebo Ideas | DIY Garden - Duration: 12:53.
-------------------------------------------
9 Television Celebrities Who Recently Engaged And Married Soon - Duration: 5:03.
9 Television Celebrities Who Recently Engaged And Married Soon
-------------------------------------------
Rod Rosenstein clashes with House Republicans amid documents dispute. - Duration: 5:28.
Rod Rosenstein clashes with House Republicans
amid documents dispute.
Deputy Attorney General Rod Rosenstein fended off feisty House Republicans at a Thursday
committee hearing, amid the passage of a resolution that puts on the record a demand for a handful
of Justice Department documents.
The hearing was a means for the House Judiciary Committee to question Rosenstein, about the
recent Justice Department's inspector general report, on the FBI investigations during the
2016 election, but GOP lawmakers seized the opportunity to chastise the department's
No. 2 for being slow, to turn over subpoenaed documents.
In his opening statement, committee Chairman Bob Goodlatte, said the panel's "oversight
has been hampered by both the FBI and DOJ's lack of consistent, and vigorous production
of the documents we need to hold the agencies accountable."
"While this production has significantly improved recently, it has felt like pulling
teeth much of the time to obtain and review relevant documents," he added.
Goodlatte's complaints did not fall on deaf ears, as the committee took a break to vote
to approve a resolution, though nonbinding and nonenforceable, that demands the Justice
Department turn over any outstanding documents from previously issued subpoenas, by the House
Judiciary and House Intelligence committees no later than July 6.
Rosenstein told lawmakers that the Justice Department has been making "unprecedented
disclosures", to Congress and praised U.S. Attorney John Lausch for his work overseeing
the process.
"I understand some people still state concerns about the speed of the production, but those
concerns are mistaken," Rosenstein said.
"Most requests have been fulfilled and other document productions are in progress for this
committee and other committees."
FBI Director Christopher Wray also defended the bureau's document production, saying
in the last week, "100 employees" have been working "day and night" to turn over
documents.
"Although we have now substantially complied with a majority of the committee's subpoena,
we are determined to get through the outstanding items and we have increased staffing on this
project even further," he added.
But Rep. Jim Jordan, was unmoved on his concerns that Rosenstein has resisted congressional
demands, accusing him of "keeping information" from Congress.
Rosenstein said the accusation was not accurate and also denied allegations, that he has been
redacting the documents to hide embarrassing information.
"Mr. Jordan, I am the deputy attorney general of the United States.
I'm not the person doing the redacting," Rosenstein answered.
"Your use of this to attack me personally is deeply wrong.
I'm not trying to hide anything."
Democrats pointed out the irony that Republican lawmakers were using the hearing to attack
Rosenstein and Wray, who are both Trump-appointed — and charged the document demands are a
means, to squeeze special counsel Robert Mueller.
Rosenstein oversees Mueller and is the only Justice Department official, with the constitutional
authority to remove him.
Rep. Trey Gowdy, who has made many of the document demands, urged the Justice Department
to finish the Russia investigation, saying it has "torn" America apart.
"There's an old saying that justice delayed is justice denied," Gowdy said.
"I think, right now, all of us are being denied.
Whatever you've got, finish it the hell up, because this country is being torn apart."
Rosenstein replied: "I have heard suggestions, that we should just close the investigation.
I think the best thing we can do is finish it appropriately and reach a conclusion."
The top Democrat on the committee slammed his Republican counterparts.
"Why has the majority abandoned the rules and traditions, that govern civility in the
House?
The tired story of Hillary Clinton's emails, of course — plus conspiracy theories about
the special counsel," said Rep. Jerrold Nadler, "As part of their coordinated and
determined effort to undermine the special counsel's investigation, Republicans are requesting
documents they know they cannot have."
"Mueller is not on a witch hunt," Wray said.
Rosenstein explained to Rep. Eric Swallwell, that he is unaware of any conflicts of interest
that would disqualify Mueller from leading the investigation.
Hours earlier, President Trump said on Twitter that Mueller should "list his conflicts
of interest."
"If there were any conflicts of interest that were brought to our attention, I would
discuss it with Mr. Mueller and then there could be review within the department, if
there were a credible allegation of a conflict of interest," Rosenstein said.
"I am not aware of any disqualifying conflict.
The hearing is a culmination of tensions that have been simmering for month between, Trump-aligned
lawmakers and the Justice Department and FBI.
On Monday, the Justice Department responded to House Intelligence Committee Chairman Devin
Nunes latest deadline for documents, telling the California Republican he already has the
"documents and answers" he has been inquiring about.
Then on Tuesday, Nunes demanded new information in an expansive request for "any contacts",
between FBI intelligence sources and a handful of Trump campaign associates.
What do you think about this?
Please share this news and scroll down to Comment below and don't forget to subscribe
top stories today.
-------------------------------------------
Meet The Teens Being Groomed As The Future Of Cyber Security | TODAY - Duration: 6:15.
-------------------------------------------
[뉴스] || 전원주 "결혼한 아들 집, 맘대로 못가…시집살이 아닌 며느리살이" 불평 ? - Duration: 2:56.
-------------------------------------------
DB Cooper letter reveals hijacker's true identity, sleuths claim - Duration: 5:05.
-------------------------------------------
10 Living Rooms With Coastal Style | Coastal Living - Duration: 1:20.
-------------------------------------------
Forklift Simulator 2018 - New Android Game 2018 - Duration: 4:58.
Forklift Simulator 2018 - New Android Game 2018
-------------------------------------------
10 Bright Small House With Smart Design Bring Extra Light To The House | Gorgeous Small House Design - Duration: 11:42.
10 Bright Small House With Smart Design Bring Extra Light To The House
-------------------------------------------
আপনি কি কোলেস্টেরল এর মাত্রা কমাতে ও ডায়াবেটিস নিয়ন্ত্রণ করতে চান ? শিমের ১০টি উপকারিতা | Bd Health - Duration: 3:32.
-------------------------------------------
Il cibo biologico fa male? - Duration: 5:19.
-------------------------------------------
Beautiful Hairstyles Tutorials Compilation for wedding Party\漂亮发型编发教程 - Duration: 12:46.
beautiful hairstyles
hairstyles tutorials
easy hairstyles
wedding hairstyles
Không có nhận xét nào:
Đăng nhận xét